package tech.easyflow.datacenter.meta.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.handler.FastjsonTypeHandler;
import tech.easyflow.common.entity.DateEntity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.Map;

@Table(value = "tb_datacenter_source", comment = "数据中心数据源")
public class DatacenterSource extends DateEntity implements Serializable {

    @Id(keyType = KeyType.Generator, value = "snowFlakeId", comment = "主键")
    private BigInteger id;
    @Column(comment = "部门ID")
    private BigInteger deptId;
    @Column(tenantId = true, comment = "租户ID")
    private BigInteger tenantId;
    @Column(comment = "数据源名称")
    private String sourceName;
    @Column(comment = "数据源编码")
    private String sourceCode;
    @Column(comment = "数据源类型")
    private String sourceType;
    @Column(comment = "访问模式")
    private String accessMode;
    @Column(comment = "是否内置")
    private Integer builtinFlag;
    @Column(comment = "驱动类名")
    private String driverClassName;
    @Column(comment = "JDBC URL")
    private String jdbcUrl;
    @Column(comment = "主机")
    private String host;
    @Column(comment = "端口")
    private Integer port;
    @Column(comment = "数据库名")
    private String databaseName;
    @Column(comment = "Schema名")
    private String schemaName;
    @Column(comment = "用户名")
    private String username;
    @Column(comment = "凭据密文")
    private String credentialCipher;
    @Column(typeHandler = FastjsonTypeHandler.class, comment = "连接配置")
    private Map<String, Object> configJson;
    @Column(typeHandler = FastjsonTypeHandler.class, comment = "能力声明")
    private Map<String, Object> capabilitiesJson;
    @Column(comment = "最近测试状态")
    private String lastTestStatus;
    @Column(comment = "最近测试信息")
    private String lastTestMessage;
    @Column(comment = "最近测试时间")
    private Date lastTestedAt;
    @Column(comment = "状态")
    private Integer status;
    @Column(typeHandler = FastjsonTypeHandler.class, comment = "扩展项")
    private Map<String, Object> options;
    @Column(comment = "创建时间")
    private Date created;
    @Column(comment = "创建人")
    private BigInteger createdBy;
    @Column(comment = "修改时间")
    private Date modified;
    @Column(comment = "修改人")
    private BigInteger modifiedBy;

    public BigInteger getId() { return id; }
    public void setId(BigInteger id) { this.id = id; }
    public BigInteger getDeptId() { return deptId; }
    public void setDeptId(BigInteger deptId) { this.deptId = deptId; }
    public BigInteger getTenantId() { return tenantId; }
    public void setTenantId(BigInteger tenantId) { this.tenantId = tenantId; }
    public String getSourceName() { return sourceName; }
    public void setSourceName(String sourceName) { this.sourceName = sourceName; }
    public String getSourceCode() { return sourceCode; }
    public void setSourceCode(String sourceCode) { this.sourceCode = sourceCode; }
    public String getSourceType() { return sourceType; }
    public void setSourceType(String sourceType) { this.sourceType = sourceType; }
    public String getAccessMode() { return accessMode; }
    public void setAccessMode(String accessMode) { this.accessMode = accessMode; }
    public Integer getBuiltinFlag() { return builtinFlag; }
    public void setBuiltinFlag(Integer builtinFlag) { this.builtinFlag = builtinFlag; }
    public String getDriverClassName() { return driverClassName; }
    public void setDriverClassName(String driverClassName) { this.driverClassName = driverClassName; }
    public String getJdbcUrl() { return jdbcUrl; }
    public void setJdbcUrl(String jdbcUrl) { this.jdbcUrl = jdbcUrl; }
    public String getHost() { return host; }
    public void setHost(String host) { this.host = host; }
    public Integer getPort() { return port; }
    public void setPort(Integer port) { this.port = port; }
    public String getDatabaseName() { return databaseName; }
    public void setDatabaseName(String databaseName) { this.databaseName = databaseName; }
    public String getSchemaName() { return schemaName; }
    public void setSchemaName(String schemaName) { this.schemaName = schemaName; }
    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }
    public String getCredentialCipher() { return credentialCipher; }
    public void setCredentialCipher(String credentialCipher) { this.credentialCipher = credentialCipher; }
    public Map<String, Object> getConfigJson() { return configJson; }
    public void setConfigJson(Map<String, Object> configJson) { this.configJson = configJson; }
    public Map<String, Object> getCapabilitiesJson() { return capabilitiesJson; }
    public void setCapabilitiesJson(Map<String, Object> capabilitiesJson) { this.capabilitiesJson = capabilitiesJson; }
    public String getLastTestStatus() { return lastTestStatus; }
    public void setLastTestStatus(String lastTestStatus) { this.lastTestStatus = lastTestStatus; }
    public String getLastTestMessage() { return lastTestMessage; }
    public void setLastTestMessage(String lastTestMessage) { this.lastTestMessage = lastTestMessage; }
    public Date getLastTestedAt() { return lastTestedAt; }
    public void setLastTestedAt(Date lastTestedAt) { this.lastTestedAt = lastTestedAt; }
    public Integer getStatus() { return status; }
    public void setStatus(Integer status) { this.status = status; }
    public Map<String, Object> getOptions() { return options; }
    public void setOptions(Map<String, Object> options) { this.options = options; }
    @Override
    public Date getCreated() { return created; }
    @Override
    public void setCreated(Date created) { this.created = created; }
    public BigInteger getCreatedBy() { return createdBy; }
    public void setCreatedBy(BigInteger createdBy) { this.createdBy = createdBy; }
    @Override
    public Date getModified() { return modified; }
    @Override
    public void setModified(Date modified) { this.modified = modified; }
    public BigInteger getModifiedBy() { return modifiedBy; }
    public void setModifiedBy(BigInteger modifiedBy) { this.modifiedBy = modifiedBy; }
}
