package org.agt.module.license.controller.admin.project.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.agt.framework.excel.core.annotations.DictFormat;
import org.agt.framework.excel.core.convert.DictConvert;
import org.agt.module.license.dal.dataobject.customer.CustomerDO;
import org.agt.module.system.api.user.AdminUserApi;

import java.time.LocalDateTime;

@Schema(description = "管理后台 - 项目 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProjectRespVO implements VO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25585")
    @ExcelProperty("主键")
    private Long id;

    @Schema(description = "客户ID")
    @Trans(type = TransType.SIMPLE, target = CustomerDO.class, fields = "name", ref = "customerName")
    private Long customerId;

    @Schema(description = "所属客户")
    @ExcelProperty("所属客户")
    private String customerName;

    @Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "aa")
    @ExcelProperty("项目名称")
    private String name;

    @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
    @ExcelProperty("项目编号")
    private Long code;

    @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1111")
    @ExcelProperty("合同编号")
    private String contractCode;

    @Schema(description = "商务状态", example = "2")
    @ExcelProperty(value = "商务状态", converter = DictConvert.class)
    @DictFormat("lic_business_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer businessStatus;

    @Schema(description = "业务负责人ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "businessOwnerName")
    private Long businessOwner;

    @Schema(description = "客户对接人ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "customerOwnerName")
    private Long customerOwner;

    @Schema(description = "技术负责人1ID", requiredMode = Schema.RequiredMode.REQUIRED)
    @Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerAName")
    private Long technicalOwnerA;

    @Schema(description = "技术负责人2ID")
    @Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerBName")
    private Long technicalOwnerB;

    @Schema(description = "技术负责人3ID")
    @Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "technicalOwnerCName")
    private Long technicalOwnerC;


    @Schema(description = "业务负责人", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("业务负责人")
    private String businessOwnerName;

    @Schema(description = "客户对接人", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("客户对接人")
    private String customerOwnerName;

    @Schema(description = "技术负责人1", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("技术负责人1")
    private String technicalOwnerAName;

    @Schema(description = "技术负责人2")
    @ExcelProperty("技术负责人2")
    private String technicalOwnerBName;

    @Schema(description = "技术负责人3")
    @ExcelProperty("技术负责人3")
    private String technicalOwnerCName;

    @Schema(description = "项目开始时间")
    @ExcelProperty("项目开始时间")
    private LocalDateTime startTime;

    @Schema(description = "项目结束时间")
    @ExcelProperty("项目结束时间")
    private LocalDateTime endTime;

    @Schema(description = "项目状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty(value = "项目状态", converter = DictConvert.class)
    @DictFormat("lic_project_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer status;

    @Schema(description = "环境信息")
    @ExcelProperty("环境信息")
    private String envInfo;

    @Schema(description = "备注", example = "随便")
    @ExcelProperty("备注")
    private String remark;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

}