package cn.reghao.bnt.web.devops.build.model.po;

import cn.reghao.bnt.common.docker.model.DockerAuth;
import cn.reghao.bnt.web.util.BaseEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.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();
    }
}
