package cn.reghao.devops.mgr.build.model.po;

import cn.reghao.devops.common.docker.model.DockerAuth;
import cn.reghao.devops.mgr.util.BaseEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

/**
 * @author reghao
 * @date 2024-07-26 17:24:57
 */
@NoArgsConstructor
@Getter
@Setter
@Entity
@Table(name = "devops_docker_registry")
public class DockerRegistry extends BaseEntity {
    @Column(nullable = false, unique = true)
    @NotBlank(message = "docker registry 不能为空字符串")
    private String registryUrl;
    private String username;
    private String password;

    public DockerRegistry(DockerAuth dockerAuth) {
        this.registryUrl = dockerAuth.getRegistryUrl();
        this.username = dockerAuth.getUsername();
        this.password = dockerAuth.getPassword();
    }
}
