package cn.axzo.msg.center.service.pending.request;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author yanglin
 */
@Data
public class TodoHandoverRequest {

    /**
     * 交接来源自然人id
     */
    @NotNull(message = "fromPersonId is required")
    private Long fromPersonId;

    /**
     * 交接来源人自然人姓名
     */
    @NotBlank(message = "fromPersonName is required")
    private String fromPersonName;

    /**
     * 交接来源单位id
     */
    @NotNull(message = "fromOuId is required")
    private Long fromOuId;

    /**
     * 交接目标自然人id
     */
    @NotNull(message = "toPersonId is required")
    private Long toPersonId;

    /**
     * 交接目标自然人姓名
     */
    private String toPersonName;

    /**
     * 交接目标单位id
     */
    @NotNull(message = "toOuId is required")
    private Long toOuId;

    /**
     * 需要转交的待办编码
     */
    @NotEmpty(message = "identityCodes is required")
    private List<String> todoIdentityCodes;

    public String determineFromPersonName() {
        return fromPersonName == null ? "" : fromPersonName;
    }

    public String determineToPersonName() {
        return toPersonName == null ? "" : toPersonName;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

}