package org.dromara.main.domain.bo;

import jakarta.validation.Valid;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * 门户背调下单请求
 */
@Data
public class PortalCheckOrderCreateBo {

    /**
     * 前端会传企业ID，实际下单仍以当前登录租户为准
     */
    private Long companyId;

    /**
     * 1-分类套餐 2-自定义条款
     */
    @NotNull(message = "订单类型不能为空")
    private Integer orderType;

    /**
     * 套餐订单必填
     */
    private Long categoryId;

    /**
     * 自定义条款订单必填，JSON数组字符串
     */
    private String clauseIds;

    private String clauseGroupKey;

    private Integer candidateCount;

    @DecimalMin(value = "0.00", inclusive = false, message = "单价必须大于0")
    private BigDecimal unitPrice;

    @DecimalMin(value = "0.00", inclusive = false, message = "总金额必须大于0")
    private BigDecimal totalAmount;

    @Valid
    @NotEmpty(message = "候选人列表不能为空")
    private List<CandidateInfo> candidates;

    @Data
    public static class CandidateInfo {

        @NotBlank(message = "候选人姓名不能为空")
        private String candidateName;

        @NotBlank(message = "候选人手机号不能为空")
        private String candidatePhone;

        @NotBlank(message = "证件类型不能为空")
        private String candidateIdType;

        @NotBlank(message = "证件号码不能为空")
        private String candidateIdNumber;
    }
}
