package com.cyksj.model.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import java.io.Serializable;
import java.util.List;

/**
 * @author chan
 * @date 2022/3/14 下午4:34
 */
@Getter
@Setter
public class ExternalContact {
    @JsonProperty("external_userid")
    private String externalUserId;

    @JsonProperty("position")
    private String position;

    @JsonProperty("name")
    private String name;

    @JsonProperty("nickname")
    private String nickname;

    @JsonProperty("avatar")
    private String avatar;

    @JsonProperty("corp_name")
    private String corpName;

    @JsonProperty("corp_full_name")
    private String corpFullName;

    @JsonProperty("type")
    private Integer type;

    @JsonProperty("gender")
    private Integer gender;

    @JsonProperty("unionid")
    private String unionId;

    @JsonProperty("external_profile")
    private ExternalProfile externalProfile;

    @Data
    public static class ExternalProfile implements Serializable {
        private static final long serialVersionUID = -2899906589789022765L;

        @JsonProperty("external_corp_name")
        private String externalCorpName;

        @JsonProperty("wechat_channels")
        private WechatChannel wechatChannels;

        @JsonProperty("external_attr")
        private List<ExternalAttribute> externalAttrs;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class WechatChannel implements Serializable {

        @JsonProperty("nickname")
        private String nickname;

        @JsonProperty("status")
        private Integer status;

    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ExternalAttribute implements Serializable {
        private static final long serialVersionUID = -1262278808286421085L;

        private int type;

        private String name;

        private Text text;

        private Web web;

        @JsonProperty("miniprogram")
        private MiniProgram miniProgram;

        @Data
        public static class Text implements Serializable {
            private static final long serialVersionUID = -8161579335600269094L;

            private String value;
        }

        @Data
        public static class Web implements Serializable {
            private static final long serialVersionUID = 3664557135411521862L;

            private String title;
            private String url;
        }

        @Data
        public static class MiniProgram implements Serializable {
            private static final long serialVersionUID = -5329210594501835796L;

            @JsonProperty("pagepath")
            private String pagePath;

            private String appid;

            private String title;
        }
    }
}
