package com.microservices.pms.journals.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.pms.journals.domain.vo.PmsJournalsChildrenDataVo;
import com.microservices.pms.journals.domain.vo.PmsJournalsParentDataVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 评论功能对象 pms_journals
 * 
 * @author otto
 * @date 2023-11-01
 */
@Data
@ApiModel("评论对象")
public class PmsJournals implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 评论ID */
    @ApiModelProperty(value = "评论ID")
    private Long id;

    /** 评论对象ID */
    @ApiModelProperty(value = "评论对象ID")
    private Long journalized_id;

    /** 评论对象类型 */
    @ApiModelProperty(value = "评论对象类型")
    private String journalized_type;

    /** gitlink用户ID */
    @ApiModelProperty(value = "gitlink用户ID")
    private Long user_id;

    /** 评论内容 */
    @ApiModelProperty(value = "评论内容")
    private String notes;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date created_on;

    /** 是否隐私评论 */
    @ApiModelProperty(value = "是否隐私评论")
    private Integer private_notes;

    /** 父级评论ID */
    @ApiModelProperty(value = "父级评论ID")
    private Long parent_id;

    /** 评论数量 */
    @ApiModelProperty(value = "评论数量")
    private Long comments_count;

    /** 回复评论ID */
    @ApiModelProperty(value = "回复评论ID")
    private Long reply_id;

    /** 审阅评论ID */
    @ApiModelProperty(value = "审阅评论ID")
    private Long review_id;

    /** 提交评论ID */
    @ApiModelProperty(value = "提交评论ID")
    private String commit_id;

    /** 差异内容 */
    @ApiModelProperty(value = "差异内容")
    private String diff;

    /** 代码所在行 */
    @ApiModelProperty(value = "代码所在行")
    private String line_code;

    /** 路径 */
    @ApiModelProperty(value = "路径")
    private String path;

    /**
     * 附件标识列表
     */
    @ApiModelProperty(value = "附件标识列表")
    private String attachment_identifiers;

    /** 状态 */
    @ApiModelProperty(value = "状态")
    private Long state;

    /** 解析时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "解析时间")
    private Date resolve_at;

    /** 解析用户ID */
    @ApiModelProperty(value = "解析用户ID")
    private Long resolveer_id;

    /** 是否需要回复 */
    @ApiModelProperty(value = "是否需要回复")
    private Integer need_respond;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updated_on;

    public PmsJournalsParentDataVo toPmsJournalsParentDataVo(){
        PmsJournalsParentDataVo target = new PmsJournalsParentDataVo();
        BeanUtils.copyProperties(this, target);
        target.setUpdated_at(this.updated_on);
        target.setCreated_at(this.created_on);
        return target;
    }

    public PmsJournalsChildrenDataVo toPmsJournalsChildrenDataVo(){
        PmsJournalsChildrenDataVo target = new PmsJournalsChildrenDataVo();
        BeanUtils.copyProperties(this, target);
        target.setUpdated_at(this.updated_on);
        target.setCreated_at(this.created_on);
        return target;
    }
}
