package cn.axzo.msg.center.service.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author yanglin
 */
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PersonV3DTO implements Serializable {

    private static final long serialVersionUID = 1231840051925115741L;

    public PersonV3DTO(Long id) {
        this.id = id;
    }

    public PersonV3DTO(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    /**
     * 自然人id
     */
    private Long id;
    /**
     * 姓名
     */
    private String name;

    /**
     * IM消息接收模型, 可以为空
     * <p>优先使用这里的ouId, 如果这里没有传, 就使用 {@link cn.axzo.msg.center.api.request.v3.MessageSendReqV3} 中的相应的信息
     */
    private ReceiveModel imReceiveModel;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ReceiveModel {

        /**
         * 接收者单位id
         */
        private Long ouId;

        /**
         * 接收者项目部id
         */
        private Long workspaceId;
    }

    public PersonDTO asV1() {
        return new PersonDTO(id, null, name);
    }
}