package com.cm.common.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: SuccessResultLayImData
 * @Description: layim返回结果
 * @Author: wanggeng
 * @Date: 2021/1/15 10:08 上午
 * @Version: 1.0
 */
@ApiModel
public class SuccessResultLayImData<T> extends SuccessResult {

    private static final long serialVersionUID = 4541100893920060211L;
    @ApiModelProperty(name = "code", value = "0表示成功，其它表示失败")
    private Integer code;
    @ApiModelProperty(name = "msg", value = "失败信息")
    private String msg;
    @ApiModelProperty(name = "data", value = "内容")
    private T data;

    public SuccessResultLayImData() {
    }

    public SuccessResultLayImData(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @ApiModel
    public static class InitData {
        @ApiModelProperty(name = "mine", value = "我的信息")
        private User mine;
        @ApiModelProperty(name = "friend", value = "好友列表")
        private List<Friend> friend;
        @ApiModelProperty(name = "group", value = "群组列表")
        private List<Group> group;

        public User getMine() {
            return mine;
        }

        public void setMine(User mine) {
            this.mine = mine;
        }

        public List<Friend> getFriend() {
            return friend;
        }

        public void setFriend(List<Friend> friend) {
            this.friend = friend;
        }

        public List<Group> getGroup() {
            return group;
        }

        public void setGroup(List<Group> group) {
            this.group = group;
        }

    }

    @ApiModel
    public static class User {
        @ApiModelProperty(name = "username", value = "我的昵称")
        private String username;
        @ApiModelProperty(name = "id", value = "我的ID")
        private String id;
        @ApiModelProperty(name = "status", value = "在线状态 online：在线、hide：隐身")
        private String status;
        @ApiModelProperty(name = "sign", value = "我的签名")
        private String sign;
        @ApiModelProperty(name = "avatar", value = "我的头像")
        private String avatar;

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getSign() {
            return sign;
        }

        public void setSign(String sign) {
            this.sign = sign;
        }

        public String getAvatar() {
            return avatar;
        }

        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }

    }

    @ApiModel
    public static class Friend {
        @ApiModelProperty(name = "groupname", value = "好友分组名")
        private String groupname;
        @ApiModelProperty(name = "id", value = "分组ID")
        private String id;
        @ApiModelProperty(name = "list", value = "分组下的好友列表")
        private List<User> list;

        public String getGroupname() {
            return groupname;
        }

        public void setGroupname(String groupname) {
            this.groupname = groupname;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public List<User> getList() {
            return list;
        }

        public void setList(List<User> list) {
            this.list = list;
        }
    }

    @ApiModel
    public static class Group {
        @ApiModelProperty(name = "groupname", value = "群组名")
        private String groupname;
        @ApiModelProperty(name = "id", value = "群组ID")
        private String id;
        @ApiModelProperty(name = "id", value = "群组头像")
        private String avatar;

        public String getGroupname() {
            return groupname;
        }

        public void setGroupname(String groupname) {
            this.groupname = groupname;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getAvatar() {
            return avatar;
        }

        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }
    }

    @ApiModel
    public static class MemberData {
        @ApiModelProperty(name = "list", value = "组员列表")
        private List<User> list;

        public List<User> getList() {
            return list == null ? new ArrayList<>() : list;
        }

        public void setList(List<User> list) {
            this.list = list;
        }
    }
}
