package org.jeecg.modules.app.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description="创建签署流程参数DTO")
public class CreateSignFlowDTO {
    @Schema(description = "文档列表")
    private List<Doc> docs;
    @Schema(description = "签署流程配置")
    private SignFlowConfig signFlowConfig;
    @Schema(description = "签署人列表")
    private List<Signer> signers;
    /**
     * 文档信息
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "文档信息")
    public static class Doc {
        @Schema(description = "文件ID")
        private String fileId;
        @Schema(description = "文件名称")
        private String fileName;
    }
    /**
     * 签署流程配置
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "签署流程配置")
    public static class SignFlowConfig {
        @Schema(description = "流程标题")
        private String signFlowTitle;

        @Schema(description = "计费配置")
        private ChargeConfig chargeConfig;
    }
    /**
     * 计费配置
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "计费配置")
    public static class ChargeConfig {
        @Schema(description = "计费模式(0-按合同计费)")
        private Integer chargeMode;
    }
    /**
     * 签署人信息
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "签署人信息")
    public static class Signer {
        @Schema(description = "通知配置")
        private NoticeConfig noticeConfig;
        @Schema(description = "组织签署人信息")
        private OrgSignerInfo orgSignerInfo;
        @Schema(description = "签署配置")
        private SignConfig signConfig;
        @Schema(description = "签署区列表")
        private List<SignField> signFields;
        @Schema(description = "签署人类型(1-组织)")
        private Integer signerType;
    }
    /**
     * 通知配置
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "通知配置")
    public static class NoticeConfig {
        @Schema(description = "通知类型集合")
        private String noticeTypes;
    }
    /**
     * 组织签署人信息
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "组织签署人信息")
    public static class OrgSignerInfo {
        @Schema(description = "组织ID")
        private String orgId;
        @Schema(description = "组织信息")
        private OrgInfo orgInfo;
        @Schema(description = "组织名称")
        private String orgName;
        @Schema(description = "经办人信息")
        private TransactorInfo transactorInfo;
    }
    /**
     * 组织基本信息
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "组织基本信息")
    public static class OrgInfo {
        @Schema(description = "法人身份证号码")
        private String legalRepIDCardNum;
        @Schema(description = "法人身份证类型")
        private String legalRepIDCardType;
        @Schema(description = "法人姓名")
        private String legalRepName;
        @Schema(description = "组织证件号码")
        private String orgIDCardNum;
        @Schema(description = "组织证件类型")
        private String orgIDCardType;
    }
    /**
     * 经办人信息
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "经办人信息")
    public static class TransactorInfo {
        @Schema(description = "经办人账号")
        private String psnAccount;
        @Schema(description = "经办人ID")
        private String psnId;
        @Schema(description = "经办人详情")
        private PsnInfo psnInfo;
    }
    /**
     * 人员信息
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "人员信息")
    public static class PsnInfo {
        @Schema(description = "银行卡号")
        private String bankCardNum;
        @Schema(description = "身份证号码")
        private String psnIDCardNum;
        @Schema(description = "身份证类型")
        private String psnIDCardType;
        @Schema(description = "人员姓名")
        private String psnName;
    }
    /**
     * 签署配置
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "签署配置")
    public static class SignConfig {
        @Schema(description = "签署顺序")
        private Integer signOrder;
    }
    /**
     * 签署区信息
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "签署区信息")
    public static class SignField {
        @Schema(description = "业务编号")
        private String customBizNum;
        @Schema(description = "文件ID")
        private String fileId;
        @Schema(description = "普通签署区配置")
        private NormalSignFieldConfig normalSignFieldConfig;
        @Schema(description = "签署区类型(0-普通签署区)")
        private Integer signFieldType;
    }
    /**
     * 普通签署区配置
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "普通签署区配置")
    public static class NormalSignFieldConfig {
        @Schema(description = "指定印章ID")
        private String assignedSealId;
        @Schema(description = "自动签署标志")
        private Boolean autoSign;
        @Schema(description = "自由模式标志")
        private Boolean freeMode;
        @Schema(description = "可移动签署区标志")
        private Boolean movableSignField;
        @Schema(description = "组织印章业务类型")
        private String orgSealBizTypes;
        @Schema(description = "人员印章样式")
        private String psnSealStyles;
        @Schema(description = "签署区位置")
        private SignFieldPosition signFieldPosition;
        @Schema(description = "签署区样式")
        private Integer signFieldStyle;
    }

    /**
     * 签署区位置
     */
    @Data
    @Accessors(chain = true)
    @Schema(description = "签署区位置")
    public static class SignFieldPosition {
        @Schema(description = "位置页面")
        private String positionPage;
        @Schema(description = "X坐标")
        private Integer positionX;
        @Schema(description = "Y坐标")
        private Integer positionY;
    }
}
