package com.gingersoft.gsa.cloud.pay.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.gingersoft.gsa.cloud.pay.PayAction;

import lombok.Data;

/**
 * @作者: bin
 * @創建時間: 2020-12-30 16:11
 * @更新時間: 2020-12-30 16:11
 * @描述:
 */
@Data
public class PosMatterExceptionParam implements Parcelable {

    private PayAction posAction;
    private String txnId;
    private long orderId;
    private String orderNo;
    private double amount;
    private String payMethodName;

    public PosMatterExceptionParam() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.txnId);
        dest.writeInt(this.posAction == null ? -1 : this.posAction.ordinal());
        dest.writeLong(this.orderId);
        dest.writeString(this.orderNo);
        dest.writeDouble(this.amount);
        dest.writeString(this.payMethodName);
    }

    protected PosMatterExceptionParam(Parcel in) {
        this.txnId = in.readString();
        int tmpPosAction = in.readInt();
        this.posAction = tmpPosAction == -1 ? null : PayAction.values()[tmpPosAction];
        this.orderId = in.readLong();
        this.orderNo = in.readString();
        this.amount = in.readDouble();
        this.payMethodName = in.readString();
    }

    public static final Creator<PosMatterExceptionParam> CREATOR = new Creator<PosMatterExceptionParam>() {
        @Override
        public PosMatterExceptionParam createFromParcel(Parcel source) {
            return new PosMatterExceptionParam(source);
        }

        @Override
        public PosMatterExceptionParam[] newArray(int size) {
            return new PosMatterExceptionParam[size];
        }
    };
}
