package com.gingersoft.gsa.cloud.ui.adapter.bean;

import android.view.inputmethod.EditorInfo;

import java.util.List;

import lombok.Data;
import me.yokeyword.fragmentation.ISupportFragment;

/**
 * @author 宇航.
 * User: admin
 * Date: 2020/11/20
 * Time: 10:45
 * Use: 多功能列表item實體類，多功能adapter使用
 */
@Data
public class InfoMultiBean {
    /**
     * 顯示一條分割線
     */
    public static final int ITEM_TYPE_LINE = 0;

    /**
     * 顯示一條字體加粗的標題
     */
    public static final int ITEM_TYPE_TITLE = 1;
    /**
     * 進入下一頁面的選擇類型，有輸入框
     */
    public final static int EDIT_FOOD_ITEM_SELECT = 2;
    /**
     * 選中時顯示列表，如果不添加列表數據，則是單選按鈕
     */
    public static final int ITEM_TYPE_SHOW_LIST = 4;
    /**
     * 上傳圖片
     */
    public final static int EDIT_FOOD_ITEM_UPLOAD_PIC = 5;
    /**
     * 選中時顯示彈窗
     */
    public static final int ITEM_TYPE_SHOW_DIALOG = 6;
    /**
     * 顯示輸入框
     */
    public static final int ITEM_TYPE_INPUT = 7;

    /**
     * 多輸入框，並且可選擇
     */
    public final static int ITEM_MULTIPLE_INPUT_SELECT = 8;

    /**
     * 備註輸入框樣式
     */
    public final static int ITEM_MULTIPLE_INPUT_REMARK = 9;

    /**
     * 複選框樣式
     */
    public final static int ITEM_MULTIPLE_CHECKBOX = 10;
    /**
     * 是否切換按鈕樣式
     */
    public final static int ITEM_MULTIPLE_BOOLEAN = 11;

    /**
     * item類型
     */
    public int itemType;
    /**
     * 用於顯示的標題
     */
    private String showTitle;
    /**
     * 是否必填
     */
    private boolean isRequired;

    /**
     * 提示文字
     */
    private String hintText;
    private String hintTextSecond;
    private String hintTextThird;

    /**
     * 顯示的值
     */
    private String showValue;
    private String showValueSecond;
    private String showValueThird;

    /**
     * 選中狀態
     */
    private boolean isChecked;
    /**
     * 當類型為輸入框時，限制輸入的內容格式
     */
    private int inputType = EditorInfo.TYPE_CLASS_TEXT;
    private int maxLength = 50;
    /**
     * 點擊展開有其他item
     */
    private List<InfoMultiBean> infoMultiBeans;

    private ISupportFragment fragment;

    public InfoMultiBean(){}

    public InfoMultiBean(int itemType) {
        this.itemType = itemType;
    }

    public InfoMultiBean(int itemType, String showTitle, boolean isRequired, String hintText, String showValue) {
        this.itemType = itemType;
        this.showTitle = showTitle;
        this.isRequired = isRequired;
        this.hintText = hintText;
        this.showValue = showValue;
    }

    public InfoMultiBean(int itemType, String showTitle) {
        this.itemType = itemType;
        this.showTitle = showTitle;
    }

    public InfoMultiBean(int itemType, String showTitle, boolean isRequired, String hintText) {
        this.itemType = itemType;
        this.showTitle = showTitle;
        this.isRequired = isRequired;
        this.hintText = hintText;
    }

    public InfoMultiBean(int itemType, String showTitle, String hintText, String hintTextSecond, String hintTextThird, ISupportFragment supportFragment) {
        this.itemType = itemType;
        this.showTitle = showTitle;
        this.hintText = hintText;
        this.hintTextSecond = hintTextSecond;
        this.hintTextThird = hintTextThird;
        this.fragment = supportFragment;
    }

    public InfoMultiBean(int itemType, String showTitle, boolean isRequired, String hintText, ISupportFragment fragment) {
        this.itemType = itemType;
        this.showTitle = showTitle;
        this.isRequired = isRequired;
        this.hintText = hintText;
        this.fragment = fragment;
    }

    public InfoMultiBean(int itemType, String showTitle, boolean isRequired) {
        this.itemType = itemType;
        this.showTitle = showTitle;
        this.isRequired = isRequired;
    }

//    public String getShowValue() {
//        if(showValue == null){
//            return "";
//        }
//        return showValue;
//    }


    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
    }
}
