package com.wmyun.module.crm.controller.admin.business.vo.business;

import com.wmyun.framework.common.validation.InEnum;
import com.wmyun.module.crm.enums.business.CrmBusinessEndStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

@Schema(description = "管理后台 - CRM 商机更新状态 Request VO")
@Data
public class CrmBusinessUpdateStatusReqVO {

    @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129")
    @NotNull(message = "商机编号不能为空")
    private Long id;

    @Schema(description = "状态编号", example = "1")
    private Long statusId;

    @Schema(description = "结束状态", example = "1")
    @InEnum(value = CrmBusinessEndStatusEnum.class)
    private Integer endStatus;

    @AssertTrue(message = "变更状态不正确")
    public boolean isStatusValid() {
        return statusId != null || endStatus != null;
    }

}
