package tech.easyflow.skill.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 tech.easyflow.system.permission.resource.VisibilityResource;

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

/**
 * Skill 主实体。
 */
@Table("tb_skill")
public class Skill extends DateEntity implements VisibilityResource, Serializable {

    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Generator, value = "snowFlakeId")
    private BigInteger id;
    @Column(tenantId = true)
    private BigInteger tenantId;
    private BigInteger deptId;
    private BigInteger categoryId;
    private String name;
    private String displayName;
    private String description;
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> metadataJson = new LinkedHashMap<>();
    private String skillContent;
    private Boolean enabled;
    private String visibilityScope;
    private String sourceType;
    private String packageHash;
    private Integer referenceCount;
    private Integer scriptCount;
    private Integer assetCount;
    private String publishStatus;
    private BigInteger currentApprovalInstanceId;
    @Column(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> publishedSnapshotJson = new LinkedHashMap<>();
    private Date publishedAt;
    private BigInteger publishedBy;
    private Date created;
    private BigInteger createdBy;
    private Date modified;
    private BigInteger modifiedBy;

    @Column(ignore = true)
    private Boolean approvalPending;
    @Column(ignore = true)
    private String currentApprovalActionType;
    @Column(ignore = true)
    private String displayPublishStatus;
    @Column(ignore = true)
    private String createdByName;
    @Column(ignore = true)
    private List<SkillReference> references;
    @Column(ignore = true)
    private List<SkillScript> scripts;
    @Column(ignore = true)
    private List<SkillAsset> assets;

    public BigInteger getId() { return id; }
    public void setId(BigInteger id) { this.id = id; }
    public BigInteger getTenantId() { return tenantId; }
    public void setTenantId(BigInteger tenantId) { this.tenantId = tenantId; }
    public BigInteger getDeptId() { return deptId; }
    public void setDeptId(BigInteger deptId) { this.deptId = deptId; }
    public BigInteger getCategoryId() { return categoryId; }
    public void setCategoryId(BigInteger categoryId) { this.categoryId = categoryId; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getDisplayName() { return displayName; }
    public void setDisplayName(String displayName) { this.displayName = displayName; }
    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
    public Map<String, Object> getMetadataJson() { return metadataJson; }
    public void setMetadataJson(Map<String, Object> metadataJson) { this.metadataJson = metadataJson == null ? new LinkedHashMap<>() : metadataJson; }
    public String getSkillContent() { return skillContent; }
    public void setSkillContent(String skillContent) { this.skillContent = skillContent; }
    public Boolean getEnabled() { return enabled; }
    public void setEnabled(Boolean enabled) { this.enabled = enabled; }
    public String getVisibilityScope() { return visibilityScope; }
    public void setVisibilityScope(String visibilityScope) { this.visibilityScope = visibilityScope; }
    public String getSourceType() { return sourceType; }
    public void setSourceType(String sourceType) { this.sourceType = sourceType; }
    public String getPackageHash() { return packageHash; }
    public void setPackageHash(String packageHash) { this.packageHash = packageHash; }
    public Integer getReferenceCount() { return referenceCount; }
    public void setReferenceCount(Integer referenceCount) { this.referenceCount = referenceCount; }
    public Integer getScriptCount() { return scriptCount; }
    public void setScriptCount(Integer scriptCount) { this.scriptCount = scriptCount; }
    public Integer getAssetCount() { return assetCount; }
    public void setAssetCount(Integer assetCount) { this.assetCount = assetCount; }
    public String getPublishStatus() { return publishStatus; }
    public void setPublishStatus(String publishStatus) { this.publishStatus = publishStatus; }
    public BigInteger getCurrentApprovalInstanceId() { return currentApprovalInstanceId; }
    public void setCurrentApprovalInstanceId(BigInteger currentApprovalInstanceId) { this.currentApprovalInstanceId = currentApprovalInstanceId; }
    public Map<String, Object> getPublishedSnapshotJson() { return publishedSnapshotJson; }
    public void setPublishedSnapshotJson(Map<String, Object> publishedSnapshotJson) { this.publishedSnapshotJson = publishedSnapshotJson == null ? new LinkedHashMap<>() : publishedSnapshotJson; }
    public Date getPublishedAt() { return publishedAt; }
    public void setPublishedAt(Date publishedAt) { this.publishedAt = publishedAt; }
    public BigInteger getPublishedBy() { return publishedBy; }
    public void setPublishedBy(BigInteger publishedBy) { this.publishedBy = publishedBy; }
    @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; }
    public Boolean getApprovalPending() { return approvalPending; }
    public void setApprovalPending(Boolean approvalPending) { this.approvalPending = approvalPending; }
    public String getCurrentApprovalActionType() { return currentApprovalActionType; }
    public void setCurrentApprovalActionType(String currentApprovalActionType) { this.currentApprovalActionType = currentApprovalActionType; }
    public String getDisplayPublishStatus() { return displayPublishStatus; }
    public void setDisplayPublishStatus(String displayPublishStatus) { this.displayPublishStatus = displayPublishStatus; }
    public String getCreatedByName() { return createdByName; }
    public void setCreatedByName(String createdByName) { this.createdByName = createdByName; }
    public List<SkillReference> getReferences() { return references; }
    public void setReferences(List<SkillReference> references) { this.references = references; }
    public List<SkillScript> getScripts() { return scripts; }
    public void setScripts(List<SkillScript> scripts) { this.scripts = scripts; }
    public List<SkillAsset> getAssets() { return assets; }
    public void setAssets(List<SkillAsset> assets) { this.assets = assets; }
}
