package com.usoftchina.qywx.sdk.dto;

import java.util.List;

/**
 * @author yingp
 * @date 2020/2/12
 */
public class GetApprovalTemplateResp extends BaseResp {
    /**
     * 模板名称，若配置了多语言则会包含中英文的模板名称，默认为zh_CN中文
     */
    private List<MultilingualText> template_names;
    /**
     * 模板控件信息
     */
    private TemplateContent template_content;

    public List<MultilingualText> getTemplate_names() {
        return template_names;
    }

    public void setTemplate_names(List<MultilingualText> template_names) {
        this.template_names = template_names;
    }

    public TemplateContent getTemplate_content() {
        return template_content;
    }

    public void setTemplate_content(TemplateContent template_content) {
        this.template_content = template_content;
    }

    public static class MultilingualText {
        private String text;
        private String lang;

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }

        public String getLang() {
            return lang;
        }

        public void setLang(String lang) {
            this.lang = lang;
        }
    }

    public static class TemplateContent {
        /**
         * 模板控件数组。模板详情由多个不同类型的控件组成，控件类型详细说明见附录。
         */
        private List<Control> controls;

        public List<Control> getControls() {
            return controls;
        }

        public void setControls(List<Control> controls) {
            this.controls = controls;
        }
    }

    public static class Control {
        /**
         * 模板控件属性，包含了模板内控件的各种属性信息
         */
        private ControlProperty property;
        /**
         * 模板控件配置，包含了部分控件类型的附加类型、属性，详见附录说明。目前有配置信息的控件类型有：Date-日期/日期+时间；Selector-单选/多选；Contact-成员/部门；Table-明细；Attendance-假勤组件（请假、外出、出差、加班）
         */
        private ControlConfig config;

        public ControlProperty getProperty() {
            return property;
        }

        public void setProperty(ControlProperty property) {
            this.property = property;
        }

        public ControlConfig getConfig() {
            return config;
        }

        public void setConfig(ControlConfig config) {
            this.config = config;
        }
    }

    public static class ControlProperty {
        /**
         * 控件类型：Text-文本；Textarea-多行文本；Number-数字；Money-金额；Date-日期/日期+时间；Selector-单选/多选；Contact-成员/部门；Tips-说明文字；File-附件；Table-明细；Attendance-假勤控件；Vacation-请假控件
         */
        private String control;
        /**
         * 控件id
         */
        private String id;
        /**
         * 控件名称，若配置了多语言则会包含中英文的控件名称，默认为zh_CN中文
         */
        private List<MultilingualText> title;
        /**
         * 控件说明，向申请者展示的控件填写说明，若配置了多语言则会包含中英文的控件说明，默认为zh_CN中文
         */
        private List<MultilingualText> placeholder;
        /**
         * 是否必填：1-必填；0-非必填
         */
        private Integer require;
        /**
         * 是否参与打印：1-不参与打印；0-参与打印
         */
        private Integer un_print;

        public String getControl() {
            return control;
        }

        public void setControl(String control) {
            this.control = control;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public List<MultilingualText> getTitle() {
            return title;
        }

        public void setTitle(List<MultilingualText> title) {
            this.title = title;
        }

        public List<MultilingualText> getPlaceholder() {
            return placeholder;
        }

        public void setPlaceholder(List<MultilingualText> placeholder) {
            this.placeholder = placeholder;
        }

        public Integer getRequire() {
            return require;
        }

        public void setRequire(Integer require) {
            this.require = require;
        }

        public Integer getUn_print() {
            return un_print;
        }

        public void setUn_print(Integer un_print) {
            this.un_print = un_print;
        }
    }

    public static class ControlConfig {
        /**
         * 类型标志，日期/日期+时间控件的config中会包含此参数
         */
        private DateControl date;
        /**
         * 类型标志，单选/多选控件的config中会包含此参数
         */
        private SelectorControl selector;
        /**
         * 类型标志，单选/多选控件的config中会包含此参数
         */
        private ContactControl contact;
        /**
         * 类型标志，明细控件的config中会包含此参数
         */
        private TableControl table;
        /**
         * 类型标志，假勤控件的config中会包含此参数
         */
        private AttendanceControl attendance;
        /**
         * 假期类型数组
         */
        private VacationControl vacation_list;

        public DateControl getDate() {
            return date;
        }

        public void setDate(DateControl date) {
            this.date = date;
        }

        public SelectorControl getSelector() {
            return selector;
        }

        public void setSelector(SelectorControl selector) {
            this.selector = selector;
        }

        public ContactControl getContact() {
            return contact;
        }

        public void setContact(ContactControl contact) {
            this.contact = contact;
        }

        public TableControl getTable() {
            return table;
        }

        public void setTable(TableControl table) {
            this.table = table;
        }

        public AttendanceControl getAttendance() {
            return attendance;
        }

        public void setAttendance(AttendanceControl attendance) {
            this.attendance = attendance;
        }

        public VacationControl getVacation_list() {
            return vacation_list;
        }

        public void setVacation_list(VacationControl vacation_list) {
            this.vacation_list = vacation_list;
        }
    }

    public static class DateControl {
        /**
         * 时间展示类型：day-日期；hour-日期+时间
         */
        private String type;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }
    }

    public static class SelectorControl {
        /**
         * 选择类型：single-单选；multi-多选
         */
        private String type;
        /**
         * 选项，包含单选/多选控件中的所有选项，可能有多个
         */
        private List<SelectorOption> options;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public List<SelectorOption> getOptions() {
            return options;
        }

        public void setOptions(List<SelectorOption> options) {
            this.options = options;
        }
    }

    public static class SelectorOption {
        /**
         * 选项key，选项的唯一id，可用于发起审批申请，为单选/多选控件赋值
         */
        private String key;
        /**
         * 选项值，若配置了多语言则会包含中英文的选项值，默认为zh_CN中文
         */
        private List<MultilingualText> value;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public List<MultilingualText> getValue() {
            return value;
        }

        public void setValue(List<MultilingualText> value) {
            this.value = value;
        }
    }

    public static class ContactControl {
        /**
         * 选择方式：single-单选；multi-多选
         */
        private String type;
        /**
         * 选择对象：user-成员；department-部门
         */
        private String mode;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getMode() {
            return mode;
        }

        public void setMode(String mode) {
            this.mode = mode;
        }
    }

    public static class TableControl {
        /**
         * 明细内的子控件，内部结构同controls
         */
        private List<Control> children;
        private List<String> stat_field;

        public List<Control> getChildren() {
            return children;
        }

        public void setChildren(List<Control> children) {
            this.children = children;
        }

        public List<String> getStat_field() {
            return stat_field;
        }

        public void setStat_field(List<String> stat_field) {
            this.stat_field = stat_field;
        }
    }

    public static class AttendanceControl {
        /**
         * 假期控件属性
         */
        private AttendanceDateRange date_range;
        /**
         * 假勤控件类型：1-请假，3-出差，4-外出，5-加班
         */
        private Integer type;

        public AttendanceDateRange getDate_range() {
            return date_range;
        }

        public void setDate_range(AttendanceDateRange date_range) {
            this.date_range = date_range;
        }

        public Integer getType() {
            return type;
        }

        public void setType(Integer type) {
            this.type = type;
        }
    }

    public static class AttendanceDateRange {
        /**
         * 时间刻度：hour-精确到分钟, halfday—上午/下午
         */
        private String type;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }
    }

    public static class VacationControl {
        /**
         * 单个假期类型属性
         */
        private List<VacationItem> item;

        public List<VacationItem> getItem() {
            return item;
        }

        public void setItem(List<VacationItem> item) {
            this.item = item;
        }
    }

    public  static class VacationItem {
        /**
         * 假期类型标识id
         */
        private Integer id;
        /**
         * 假期类型名称，默认zh_CN中文名称
         */
        private List<MultilingualText> name;

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public List<MultilingualText> getName() {
            return name;
        }

        public void setName(List<MultilingualText> name) {
            this.name = name;
        }
    }
}
