package com.microservices.zone.resource.domain.vo;

import com.microservices.zone.resource.enums.AiResourceCategory;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 模型提报输入VO
 */
@Data
@ApiModel("模型提报输入")
public class AiModelInputVo {

    @ApiModelProperty(value = "模型名称", required = true)
    @NotBlank(message = "模型名称不能为空")
    @Size(max = 100, message = "模型名称不能超过100个字符")
    private String name;

    @ApiModelProperty(value = "资源领域Id", required = true)
    @NotNull(message = "资源领域Id不能为空")
    private Long domainId;

    @ApiModelProperty(value = "模型简介")
    @Size(max = 500, message = "模型简介不能超过500个字符")
    private String summary;

    @ApiModelProperty(value = "资源标签，逗号分隔")
    private String keywords;

    @ApiModelProperty(value = "模型文件Id", required = true)
    @NotNull(message = "模型文件Id不能为空")
    private Long fileId;

    @ApiModelProperty(value = "所属专区", required = true)
    @NotNull(message = "所属专区不能为空")
    private Long zoneId;

    public ZoneResourceInputVo toZoneResourceInputVo() {
        // 构建 ZoneResourceInputVo
        ZoneResourceInputVo zoneResourceInputVo = new ZoneResourceInputVo();
        zoneResourceInputVo.setName(this.getName());
        zoneResourceInputVo.setSummary(this.getSummary());
        zoneResourceInputVo.setKeywords(this.getKeywords());
        zoneResourceInputVo.setDomainId(this.getDomainId());
        zoneResourceInputVo.setZoneId(this.getZoneId());
        zoneResourceInputVo.setFileIds(String.valueOf(this.getFileId()));
        zoneResourceInputVo.setResourceCategory(AiResourceCategory.MODEL.getCode());
        return zoneResourceInputVo;
    }
}
