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

import android.graphics.Color;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.google.gson.annotations.SerializedName;

import lombok.Data;

/**
 * 作者：ELEGANT_BIN
 * 版本：1.6.0
 * 创建日期：2020-02-15
 * 修订历史：2020-02-15
 * 描述：
 */
@Data
public class PayMethod implements Parcelable {

    /**
     * id : 12
     * brandId : 1
     * restaurantId : 26
     * nameFirst : 兒不同
     * nameSecond : 吃v否
     * nameThird : 份日日法人
     * whetherSales : 1
     * whetherManagerAuthority : 0
     * color : #00FF2F
     * whetherReportCount : 1
     * interactiveType : 1
     * whetherFixedAmount : 1
     * payType : 8
     * minPayAmount : 0
     * whetherFreeService : 1
     * whetherTaxExemption : 1
     * whetherSignatureLine : 1
     * paySeq : 1
     * whetherOpenBox : 1
     * getIntegral : 5
     * integralMultiple : 2
     * deductionIntegral : 1
     * dockingType : 0
     * billType : 1,2
     * tablePrintingAmount : 2
     * takeOutPrintingAmount : 2
     * updateTime : 1598674202856
     * createTime : 1598674202856
     * updateUid : 492
     * createUid : 492
     */

    private int id;
    private int brandId;
    private int restaurantId;
    private String nameFirst;
    private String nameSecond;
    private String nameThird;
    /**
     * 銷售營業額(0:非營業額 1：營業額)
     */
    private int whetherSales;
    /**
     * 經理權限
     */
    private int whetherManagerAuthority;
    /**
     * 背景顔色
     */
    private String color = "#FFFFFF";
    /**
     * 字體顔色
     */
    private String font_color = "#000000";
    /**
     * 報表計算人數(0:否 1：是)
     */
    private int whetherReportCount;
    /**
     * 交互方式
     */
    private int interactiveType;
    /**
     * 固定金額 (0:否 1：是)
     */
    private int whetherFixedAmount;
    /**
     * 固定金額數值
     */
    private double amountValue;
    /**
     * 支付方式(1:寶達通 8:支付寶 1001:現金 1023:支付寶HK，1031:N5掃碼 1031：N5刷卡
     */
    private int payType;

    /**
     * N5支付支付類型
     */
    public static final int HYWEB_POS_TYPE_CC = 1030;
    public static final int HYWEB_POS_TYPE_QRC = 1031;

    /**
     * 最小支付金額（是否有小數點）
     */
    private double minPayAmount;
    /**
     * 是否免服務費(0:否 1：是)
     */
    private int whetherFreeService;
    /**
     * 是否免稅  (0:否 1：是)
     */
    private int whetherTaxExemption;
    /**
     * 是否展示簽署線 (0:否 1：是)
     */
    private int whetherSignatureLine;
    /**
     * 排序
     */
    private int paySeq;
    /**
     * 是否開錢箱(0:否 1：是)
     */
    private int whetherOpenBox;
    /**
     * '獲取積分
     */
    private int getIntegral;
    /**
     * 積分倍數
     */
    private int integralMultiple;
    /**
     * 扣減積分
     */
    private float deductionIntegral;
    /**
     * 對接類型 (0:否 1:yedpay 2:八達通 3:積分 )
     */
    private int dockingType;
    /**
     * 賬單類型(0:否 1：是)
     */
    private String billType;
    /**
     * 櫃檯結賬打印
     */
    private int tablePrintingAmount;
    /**
     * 外賣結賬打印
     */
    private int takeOutPrintingAmount;
    private long updateTime;
    @SerializedName("createTime")
    private long createTimeX;
    private int updateUid;
    private int createUid;


    //*************自定義字段***************
    private double payMoney = 0.0;
    private double TipsPrice = 0.0;
    private int payModeTextColor = Color.parseColor("#000000");
    private int payMoneyTextColor = Color.parseColor("#000000");
    private int payModeTextSelectColor = Color.parseColor("#000000");
    private int payMoneyTextSelectColor = Color.parseColor("#000000");
    private int payModeSize = 14;
    private int payMoneySize = 14;

    public static final int PAY_TYPE_CASH = 1001;
    public static final int PAY_TYPE_INTEGRAL = 2000;


    public PayMethod() {
    }

    public PayMethod(int id, String nameFirst, String nameSecond, String nameThird) {
        this.id = id;
        this.nameFirst = nameFirst;
        this.nameSecond = nameSecond;
        this.nameThird = nameThird;
    }

    public PayMethod(PayMethod method) {
        this.id = method.id;
        this.brandId = method.brandId;
        this.restaurantId = method.restaurantId;
        this.nameFirst = method.nameFirst;
        this.nameSecond = method.nameSecond;
        this.nameThird = method.nameThird;
        this.whetherSales = method.whetherSales;
        this.whetherManagerAuthority = method.whetherManagerAuthority;
        this.color = method.color;
        this.font_color = method.font_color;
        this.whetherReportCount = method.whetherReportCount;
        this.interactiveType = method.interactiveType;
        this.whetherFixedAmount = method.whetherFixedAmount;
        this.amountValue = method.amountValue;
        this.payType = method.payType;
        this.minPayAmount = method.minPayAmount;
        this.whetherFreeService = method.whetherFreeService;
        this.whetherTaxExemption = method.whetherTaxExemption;
        this.whetherSignatureLine = method.whetherSignatureLine;
        this.paySeq = method.paySeq;
        this.whetherOpenBox = method.whetherOpenBox;
        this.getIntegral = method.getIntegral;
        this.integralMultiple = method.integralMultiple;
        this.deductionIntegral = method.deductionIntegral;
        this.dockingType = method.dockingType;
        this.billType = method.billType;
        this.tablePrintingAmount = method.tablePrintingAmount;
        this.takeOutPrintingAmount = method.takeOutPrintingAmount;
        this.updateTime = method.updateTime;
        this.createTimeX = method.createTimeX;
        this.updateUid = method.updateUid;
        this.createUid = method.createUid;
        this.payMoney = method.payMoney;
        this.TipsPrice = method.TipsPrice;
        this.payModeTextColor = method.payModeTextColor;
        this.payMoneyTextColor = method.payMoneyTextColor;
        this.payModeTextSelectColor = method.payModeTextSelectColor;
        this.payMoneyTextSelectColor = method.payMoneyTextSelectColor;
        this.payModeSize = method.payModeSize;
        this.payMoneySize = method.payMoneySize;
    }



    public String getPayName() {
        if (!TextUtils.isEmpty(nameFirst)) {
            return nameFirst;
        }
        if (!TextUtils.isEmpty(nameSecond)) {
            return nameSecond;
        }
        if (!TextUtils.isEmpty(nameThird)) {
            return nameThird;
        }
        return "";
    }

    public void setPayName(String name) {
        this.nameFirst = name;
        this.nameSecond = name;
        this.nameThird = name;
    }


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

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeInt(this.brandId);
        dest.writeInt(this.restaurantId);
        dest.writeString(this.nameFirst);
        dest.writeString(this.nameSecond);
        dest.writeString(this.nameThird);
        dest.writeInt(this.whetherSales);
        dest.writeInt(this.whetherManagerAuthority);
        dest.writeString(this.color);
        dest.writeString(this.font_color);
        dest.writeInt(this.whetherReportCount);
        dest.writeInt(this.interactiveType);
        dest.writeInt(this.whetherFixedAmount);
        dest.writeDouble(this.amountValue);
        dest.writeInt(this.payType);
        dest.writeDouble(this.minPayAmount);
        dest.writeInt(this.whetherFreeService);
        dest.writeInt(this.whetherTaxExemption);
        dest.writeInt(this.whetherSignatureLine);
        dest.writeInt(this.paySeq);
        dest.writeInt(this.whetherOpenBox);
        dest.writeInt(this.getIntegral);
        dest.writeInt(this.integralMultiple);
        dest.writeFloat(this.deductionIntegral);
        dest.writeInt(this.dockingType);
        dest.writeString(this.billType);
        dest.writeInt(this.tablePrintingAmount);
        dest.writeInt(this.takeOutPrintingAmount);
        dest.writeLong(this.updateTime);
        dest.writeLong(this.createTimeX);
        dest.writeInt(this.updateUid);
        dest.writeInt(this.createUid);
        dest.writeDouble(this.payMoney);
        dest.writeDouble(this.TipsPrice);
        dest.writeInt(this.payModeTextColor);
        dest.writeInt(this.payMoneyTextColor);
        dest.writeInt(this.payModeTextSelectColor);
        dest.writeInt(this.payMoneyTextSelectColor);
        dest.writeInt(this.payModeSize);
        dest.writeInt(this.payMoneySize);
    }

    protected PayMethod(Parcel in) {
        this.id = in.readInt();
        this.brandId = in.readInt();
        this.restaurantId = in.readInt();
        this.nameFirst = in.readString();
        this.nameSecond = in.readString();
        this.nameThird = in.readString();
        this.whetherSales = in.readInt();
        this.whetherManagerAuthority = in.readInt();
        this.color = in.readString();
        this.font_color = in.readString();
        this.whetherReportCount = in.readInt();
        this.interactiveType = in.readInt();
        this.whetherFixedAmount = in.readInt();
        this.amountValue = in.readDouble();
        this.payType = in.readInt();
        this.minPayAmount = in.readDouble();
        this.whetherFreeService = in.readInt();
        this.whetherTaxExemption = in.readInt();
        this.whetherSignatureLine = in.readInt();
        this.paySeq = in.readInt();
        this.whetherOpenBox = in.readInt();
        this.getIntegral = in.readInt();
        this.integralMultiple = in.readInt();
        this.deductionIntegral = in.readFloat();
        this.dockingType = in.readInt();
        this.billType = in.readString();
        this.tablePrintingAmount = in.readInt();
        this.takeOutPrintingAmount = in.readInt();
        this.updateTime = in.readLong();
        this.createTimeX = in.readLong();
        this.updateUid = in.readInt();
        this.createUid = in.readInt();
        this.payMoney = in.readDouble();
        this.TipsPrice = in.readDouble();
        this.payModeTextColor = in.readInt();
        this.payMoneyTextColor = in.readInt();
        this.payModeTextSelectColor = in.readInt();
        this.payMoneyTextSelectColor = in.readInt();
        this.payModeSize = in.readInt();
        this.payMoneySize = in.readInt();
    }

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

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