package com.njcn.rdms.module.project.dal.dataobject.personal;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.njcn.rdms.framework.mybatis.core.dataobject.BaseDO;
import com.njcn.rdms.module.project.dal.dataobject.attachment.AttachmentItem;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * 个人事项主表。
 */
@TableName(value = "rdms_personal_item", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
public class PersonalItemDO extends BaseDO {

    @TableId
    private Long id;

    private String taskTitle;

    private String type;

    private Long ownerId;

    private String statusCode;

    private BigDecimal progressRate;

    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDate plannedStartDate;

    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDate plannedEndDate;

    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDate actualStartDate;

    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDate actualEndDate;

    @TableField(value = "task_desc", updateStrategy = FieldStrategy.ALWAYS)
    private String taskDesc;

    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private String lastStatusReason;

    @TableField(typeHandler = JacksonTypeHandler.class, updateStrategy = FieldStrategy.ALWAYS)
    private List<AttachmentItem> attachments;
}
