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

import com.mzt.logapi.starter.annotation.DiffLogField;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.agt.module.license.framework.operatelog.core.BusinessStatusParseFunction;
import org.agt.module.license.framework.operatelog.core.CommonAdminUserParseFunction;
import org.agt.module.license.framework.operatelog.core.CustomerNameParseFunction;
import org.agt.module.license.framework.operatelog.core.EnvInfoParseFunction;
import org.agt.module.license.framework.operatelog.core.LocalDateTimeParseFunction;
import org.agt.module.license.framework.operatelog.core.OperatingSystemParseFunction;
import org.agt.module.license.framework.operatelog.core.ProjectStatusParseFunction;
import org.agt.module.license.framework.operatelog.core.SoftwareVersionParseFunction;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

import static org.agt.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 项目新增/修改 Request VO")
@Data
public class ProjectSaveReqVO {

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

    @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10982")
    @NotNull(message = "客户ID不能为空")
    @DiffLogField(name = "所属客户", function = CustomerNameParseFunction.NAME)
    private Long customerId;

    @Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "aa")
    @NotEmpty(message = "项目名称不能为空")
    @DiffLogField(name = "项目名称")
    private String name;

    @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
    @NotEmpty(message = "项目编号不能为空")
    @DiffLogField(name = "项目编号")
    private String code;

    @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1111")
    @NotEmpty(message = "合同编号不能为空")
    @DiffLogField(name = "合同编号")
    private String contractCode;

    @Schema(description = "商务状态", example = "2")
    @DiffLogField(name = "商务状态", function = BusinessStatusParseFunction.NAME)
    private Integer businessStatus;

    @Schema(description = "业务负责人", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "业务负责人不能为空")
    @DiffLogField(name = "业务负责人", function = CommonAdminUserParseFunction.NAME)
    private Long businessOwner;

    @Schema(description = "客户对接人", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "客户对接人不能为空")
    @DiffLogField(name = "客户对接人")
    private String customerOwner;

    @Schema(description = "技术负责人1", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "技术负责人1不能为空")
    @DiffLogField(name = "技术负责人1", function = CommonAdminUserParseFunction.NAME)
    private Long technicalOwnerA;

    @Schema(description = "技术负责人2")
    @DiffLogField(name = "技术负责人2", function = CommonAdminUserParseFunction.NAME)
    private Long technicalOwnerB;

    @Schema(description = "技术负责人3")
    private Long technicalOwnerC;

    @Schema(description = "项目开始时间")
    @DiffLogField(name = "项目开始时间", function = LocalDateTimeParseFunction.NAME)
    private LocalDateTime startTime;

    @Schema(description = "项目结束时间")
    @DiffLogField(name = "项目结束时间", function = LocalDateTimeParseFunction.NAME)
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime endTime;

    @Schema(description = "项目状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotNull(message = "项目状态不能为空")
    @DiffLogField(name = "项目状态", function = ProjectStatusParseFunction.NAME)
    private Integer status;

    @Schema(description = "环境信息")
    @DiffLogField(name = "环境信息", function = EnvInfoParseFunction.NAME)
    private Integer envInfo;

    @Schema(description = "操作系统平台")
    @DiffLogField(name = "操作系统平台", function = OperatingSystemParseFunction.NAME)
    private Integer operatingSystem;

    @Schema(description = "软件版本")
    @DiffLogField(name = "软件版本", function = SoftwareVersionParseFunction.NAME)
    private Integer softwareVersion;

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

    @Schema(description = "文件url")
    private String fileUrl;
}