package com.galaxis.manatee.entity.chuanyun.data.object;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.galaxis.manatee.util.ChuanyunLocalDateTimeDeserializer;
import com.galaxis.manatee.util.ChuanyunLocalDateTimeSerializer;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import java.time.LocalDateTime;

/**
 * @author zcj
 * @version 0.1
 * @date 2020/2/13 5:22 下午
 */
@Data
@Entity(name = "BASIC_DO")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class BasicDO {
    /**
     * 项目Id
     */
    @JsonProperty(value = "ObjectId")
    @Id
    private String objectId;
    /**
     * 数据标题
     */
    @JsonProperty("Name")
    private String name;
    /**
     * 创建时间
     */
    @JsonProperty("CreatedTime")
    @JsonSerialize(using = ChuanyunLocalDateTimeSerializer.class)
    @JsonDeserialize(using = ChuanyunLocalDateTimeDeserializer.class)
    @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    private LocalDateTime createdTime;
    /**
     * 被谁修改
     */
    @JsonProperty("ModifiedBy")
    private String modifiedBy;
    /**
     * 修改时间
     */
    @JsonProperty("ModifiedTime")
    @JsonSerialize(using = ChuanyunLocalDateTimeSerializer.class)
    @JsonDeserialize(using = ChuanyunLocalDateTimeDeserializer.class)
    @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    private LocalDateTime modifiedTime;
    /**
     * 工作流Id
     */
    @JsonProperty("WorkflowInstanceId")
    private String workflowInstanceId;
    /**
     * 状态(具体值的含义需要查询)
     * 0----暂存
     * 2----提交
     */
    @JsonProperty("Status")
    private Integer status;
    /**
     * 拥有者所在部门Id
     */
    @JsonProperty("OwnerDeptId")
    private String ownerDepartmentId;

    @Data
    public static class RelationObject {
        @JsonProperty("ObjectId")
        private String objectId;
        @JsonProperty("Name")
        private String name;
    }
}
