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

import com.microservices.system.api.domain.SysFileBytes;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
 * 制品组件Maven输入对象
 *
 * @author otto
 * @date 2024-06-28
 */
@Data
@ApiModel("制品文件Maven输入对象")
public class AssetMavenInputVo {
    @ApiModelProperty(value = "后缀")
    @NotBlank(message = "制品文件后缀不能为空")
    private String extension;
    @ApiModelProperty(value = "分类")
    private String classifier;
    @ApiModelProperty(value = "文件标识")
    @NotBlank(message = "制品文件标识不能为空")
    private String fileIdentifier;
    @ApiModelProperty(value = "文件流", hidden = true)
    private SysFileBytes fileBytes;

    public String getComponentAssetName(ComponentMavenInputVo componentMavenInputVo) {
        return String.format("%s-%s-%s.%s",
                componentMavenInputVo.getArtifactId(),
                componentMavenInputVo.getVersion(),
                classifier,
                extension);
    }
}
