package pwc.taxtech.drop;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.sql.Date;
import java.util.Objects;

import static pwc.taxtech.Const.*;

@Entity
@Table(name = "WORKFLOW", schema = PROJECT_ADMIN, catalog = "")
public class Workflow {
    private String id;
    private String name;
    private String code;
    private String workflowCategoryId;
    private String comment;
    private String createBy;
    private Date createTime;
    private String updateBy;
    private Date updateTime;

    @Id
    @Column(name = "ID", nullable = false, length = 128)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "NAME", nullable = false, length = 100)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "CODE", nullable = true, length = 100)
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "WORKFLOW_CATEGORY_ID", nullable = false, length = 128)
    public String getWorkflowCategoryId() {
        return workflowCategoryId;
    }

    public void setWorkflowCategoryId(String workflowCategoryId) {
        this.workflowCategoryId = workflowCategoryId;
    }

    @Basic
    @Column(name = B_Delimiter + "COMMENT" + E_Delimiter, nullable = true, columnDefinition = DEF_BIG_STRING)
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Basic
    @Column(name = "CREATE_BY", nullable = false, length = 128)
    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    @Basic
    @Column(name = "CREATE_TIME", nullable = false, columnDefinition = DEF_DEFAULT_DATE)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "UPDATE_BY", nullable = false, length = 128)
    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    @Basic
    @Column(name = "UPDATE_TIME", nullable = false, columnDefinition = DEF_DEFAULT_DATE)
    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Workflow workflow = (Workflow) o;
        return Objects.equals(id, workflow.id) &&
                Objects.equals(name, workflow.name) &&
                Objects.equals(code, workflow.code) &&
                Objects.equals(workflowCategoryId, workflow.workflowCategoryId) &&
                Objects.equals(comment, workflow.comment) &&
                Objects.equals(createBy, workflow.createBy) &&
                Objects.equals(createTime, workflow.createTime) &&
                Objects.equals(updateBy, workflow.updateBy) &&
                Objects.equals(updateTime, workflow.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, code, workflowCategoryId, comment, createBy, createTime, updateBy, updateTime);
    }
}