package com.yonge.cooleshow.biz.dal.wrapper;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import com.yonge.cooleshow.common.enums.UserLockFlag;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.util.Optional;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * 机构员工表
 * 2023-07-21 17:32:49
 */
@ApiModel(value = "TenantStaffWrapper对象", description = "机构员工表查询对象")
public class TenantStaffWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantStaffQuery-机构员工表")
    public static class TenantStaffQuery implements QueryInfo {
    
    	@ApiModelProperty("当前页")
        private Integer page;
        
        @ApiModelProperty("分页行数")
        private Integer rows;
        
        @ApiModelProperty("关键字匹配")
		private String keyword;

        @ApiModelProperty("机构ID")
        private Integer tenantId;

        @ApiModelProperty("账号状态，0：正常，1：锁定")
        private UserLockFlag status;

        @ApiModelProperty("是否是主管理员")
        private Boolean manageAdmin;

        @ApiModelProperty("绑定状态")
        private Boolean bindStatus;

        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static TenantStaffQuery from(String json) {
            return JSON.parseObject(json, TenantStaffQuery.class);
        }
    }  

    @Data
	@ApiModel(" TenantStaff-机构员工表")
    public static class TenantStaff {

        @ApiModelProperty("主键ID")
        private Long id;

        @ApiModelProperty("机构ID")
        private Long tenantId;

        @ApiModelProperty("用户ID")
        private Long userId;

        @ApiModelProperty("头像")
        private String avatar;

        @ApiModelProperty("昵称")
        private String nickname;

        @ApiModelProperty("IM授权签名")
        private String imToken;

        @ApiModelProperty("微信ID")
        private String wechatId;

        @ApiModelProperty("微信OpenID")
        private String wxOpenid;

        @ApiModelProperty("公众号关注标识")
        private Boolean subscribeFlag;

        @ApiModelProperty("管理员标识")
        private Boolean manageAdmin;

        @ApiModelProperty("介绍")
        private String introduction;

        @ApiModelProperty("帐号状态(注销，冻结，激活)")
        private UserLockFlag status;

        @ApiModelProperty("更新时间")
        private Date updateTime;

        @ApiModelProperty("创建时间")
        private Date createTime;

        @ApiModelProperty("机构名称")
        private String tenantName;

        @ApiModelProperty("手机号")
        private String phone;

        @ApiModelProperty("绑定状态")
        private Boolean bindStatus;

        @ApiModelProperty("性别,0:女，1：男")
        private Integer gender;

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static TenantStaff from(String json) {
            return JSON.parseObject(json, TenantStaff.class);
        }
	}

    @Data
    @ApiModel(" TenantStaff-机构员工表")
    public static class TenantStaffAdd {

        @ApiModelProperty("主键ID")
        private Long id;

        @ApiModelProperty("机构ID")
        private Long tenantId;

        @ApiModelProperty("用户ID")
        private Long userId;

        @ApiModelProperty("昵称")
        private String nickname;

        @ApiModelProperty("性别,0:女，1：男")
        private Integer gender;

        @ApiModelProperty("手机号")
        private String phone;

        @ApiModelProperty("是否是主管理员")
        private Boolean manageAdmin;

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static TenantStaff from(String json) {
            return JSON.parseObject(json, TenantStaff.class);
        }
    }
}