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

import com.microservices.pms.productLibrary.domain.PmsProductLibraryRepositories;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Size;
import java.util.List;

/**
 * 虚拟仓库成员对象
 *
 * @author otto
 * @date 2024-07-04
 */
@Data
@ApiModel("虚拟仓库成员对象")
public class NexusRepoGroupVo {
    @ApiModelProperty(value = "成员列表")
    @Size(min = 1, message = "成员列表不能为空")
    private List<String> memberNames;

    public NexusRepoGroupVo toNexusRepoGroupVo(String enterpriseIdentifier) {
        for (int i = 0; i < memberNames.size(); i++) {
            String memberName = memberNames.get(i);
            memberName = PmsProductLibraryRepositories.getNexusRepositoriesName(enterpriseIdentifier, memberName);
            memberNames.set(i, memberName);
        }
        return this;
    }
}
