package com.unibuy.smartdevice.devices;

import com.unibuy.smartdevice.exception.Logs;
import com.unibuy.smartdevice.exception.LogsEmptyException;

public enum SlotField {
    VMC(0, false, true, true, true, true, true, true, true, true, true),
    ELECTRIC(1, true, false, false, true, true, false, true, false,  true, true),
    ;

    public int getField() {
        return field;
    }

    public boolean isCanAddPurchased() {
        return isCanAddPurchased;
    }

    public boolean isCanOneShipped() {
        return isCanOneShipped;
    }

    public boolean isInvoice() {
        return isInvoice;
    }

    public boolean isDevNFCPay() {
        return isDevNFCPay;
    }

    public boolean isDevEsunpay() {
        return isDevEsunpay;
    }

    public boolean isDevTapPay() {
        return isDevTapPay;
    }

    public boolean isDevCash() {
        return isDevCash;
    }

    public boolean isDevLinePay() {
        return isDevLinePay;
    }

    public boolean isAutoNextProduct() {
        return isAutoNextProduct;
    }

    public boolean isAutoConfirm() {
        return isAutoConfirm;
    }

    private Logs logs;
    private int field;
    private boolean isCanAddPurchased;
    private boolean isCanOneShipped;
    private boolean isInvoice;
    private boolean isDevNFCPay;
    private boolean isDevEsunpay;
    private boolean isDevTapPay;
    private boolean isDevCash;
    private boolean isDevLinePay;
    private boolean isAutoNextProduct;
    private boolean isAutoConfirm;

    SlotField(int field, boolean isCanAddPurchased, boolean isCanOneShipped, boolean isInvoice, boolean isDevNFCPay, boolean isDevEsunpay, boolean isDevTapPay, boolean isDevCash, boolean isDevLinePay, boolean isAutoNextProduct, boolean isAutoConfirm) {
        this.logs = new Logs(getClass());
        this.field = field;
        this.isCanAddPurchased = isCanAddPurchased;
        this.isCanOneShipped = isCanOneShipped;
        this.isInvoice = isInvoice;
        this.isDevNFCPay = isDevNFCPay;
        this.isDevEsunpay = isDevEsunpay;
        this.isDevTapPay = isDevTapPay;
        this.isDevCash = isDevCash;
        this.isDevLinePay = isDevLinePay;
        this.isAutoNextProduct = isAutoNextProduct;
        this.isAutoConfirm = isAutoConfirm;
    }

    public static SlotField getSlotField(int field) throws LogsEmptyException {
        SlotField slotField = null;
        for (SlotField slotFieldTmp: SlotField.values()) {
            if (slotFieldTmp.getField() == field) {
                slotField = slotFieldTmp;
                break;
            }
        }
        if (slotField != null) {
            return slotField;
        } else {
            throw new LogsEmptyException(new Logs(SlotField.class), "Missing additional items");
        }
    }
}
