package com.microservices.pms.product.domain.vo;

import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.pms.product.domain.PmsProduct;
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;

/**
 * 产品对象 pms_product
 * 
 * @author otto
 * @date 2023-10-10
 */
@Data
@ApiModel("产品输入对象")
public class PmsProductInputVo
{
    /** 产品名 */
    @ApiModelProperty(value = "产品名")
    @NotBlank(message = "产品名不能为空")
    @Size(max = 50, message = "长度需要小于50")
    private String productName;

    /** 产品描述 */
    @ApiModelProperty(value = "产品描述")
    @Size(max = 200, message = "长度需要小于200")
    private String productDescription;

    /**
     * 产品负责人Gitlink ID列表
     */
    @ApiModelProperty(value = "产品负责人Gitlink ID列表")
    @NotBlank(message = "产品负责人列表不能为空")
    private String productAssigneeGitlinkIds;

    /** 关联企业ID */
    @ApiModelProperty(value = "关联企业标识", hidden = true)
    private String pmsEnterpriseIdentifier;

    @ApiModelProperty(value = "产品标识", required = true)
    @NotNull
    @Size(max = 50, message = "长度需要小于50")
    private String productIdentifier;

    public PmsProduct toPmsProduct(String pmsEnterpriseIdentifier) {
        PmsProduct target = new PmsProduct();
        BeanUtils.copyProperties(this, target);
        target.setPmsEnterpriseIdentifier(pmsEnterpriseIdentifier);
        return target;
    }
}
