package com.unibuy.smartdevice.structure;

/**
 * HardwareSet：硬體貨道類型設定（B014 HardwareSet）。
 * 每個欄位代表一段貨道（10 槽一組）的型式：true=彈簧 / false=履帶。
 * 由雲端 B014 下發，主控台系統方可編輯後回寫雲端。預設 false。
 */
public class HardwareSetStructure {
    private boolean springSlot1_10;
    private boolean springSlot11_20;
    private boolean springSlot21_30;
    private boolean springSlot31_40;
    private boolean springSlot41_50;
    private boolean springSlot51_60;

    public HardwareSetStructure(boolean springSlot1_10, boolean springSlot11_20, boolean springSlot21_30,
                                boolean springSlot31_40, boolean springSlot41_50, boolean springSlot51_60) {
        this.springSlot1_10 = springSlot1_10;
        this.springSlot11_20 = springSlot11_20;
        this.springSlot21_30 = springSlot21_30;
        this.springSlot31_40 = springSlot31_40;
        this.springSlot41_50 = springSlot41_50;
        this.springSlot51_60 = springSlot51_60;
    }

    public boolean isSpringSlot1_10() { return springSlot1_10; }
    public void setSpringSlot1_10(boolean v) { springSlot1_10 = v; }

    public boolean isSpringSlot11_20() { return springSlot11_20; }
    public void setSpringSlot11_20(boolean v) { springSlot11_20 = v; }

    public boolean isSpringSlot21_30() { return springSlot21_30; }
    public void setSpringSlot21_30(boolean v) { springSlot21_30 = v; }

    public boolean isSpringSlot31_40() { return springSlot31_40; }
    public void setSpringSlot31_40(boolean v) { springSlot31_40 = v; }

    public boolean isSpringSlot41_50() { return springSlot41_50; }
    public void setSpringSlot41_50(boolean v) { springSlot41_50 = v; }

    public boolean isSpringSlot51_60() { return springSlot51_60; }
    public void setSpringSlot51_60(boolean v) { springSlot51_60 = v; }

    /**
     * 依貨道號回傳是否為彈簧貨道（對齊後台 SPRING_SLOT_FLAGS 的 10 槽分組）。
     * 超出 1–60 範圍視為履帶（false），維持「未知一律走履帶上限」的安全預設。
     */
    public boolean isSpringSlot(int slotNo) {
        if (slotNo >= 1  && slotNo <= 10) return springSlot1_10;
        if (slotNo >= 11 && slotNo <= 20) return springSlot11_20;
        if (slotNo >= 21 && slotNo <= 30) return springSlot21_30;
        if (slotNo >= 31 && slotNo <= 40) return springSlot31_40;
        if (slotNo >= 41 && slotNo <= 50) return springSlot41_50;
        if (slotNo >= 51 && slotNo <= 60) return springSlot51_60;
        return false;
    }
}
