package me.zhengjie.modules.flow.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;

@Entity
@Getter
@Setter
@Table(name = "sys_flow")
public class Flow extends BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`flow_id`")
    @ApiModelProperty(value = "流向ID")
    private Long flowId;

    @Column(name = "`user_id`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "流向用户ID")
    private Long userId;

    @Column(name = "`flow_type`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "流向类型")
    private Integer flowType;

    @Column(name = "`flow_name`")
    @ApiModelProperty(value = "流向名称")
    private String flowName;

    public void copy(Flow source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
