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

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import com.yonge.cooleshow.common.enums.ESettlementFrom;
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-12-04 15:30:02
 */
@ApiModel(value = "UserTenantBindRecordWrapper对象", description = "用户机构绑定解绑记录查询对象")
public class UserTenantBindRecordWrapper {

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" UserTenantBindRecordQuery-用户机构绑定解绑记录")
    public static class UserTenantBindRecordQuery implements QueryInfo {

        @ApiModelProperty("当前页")
        private Integer page;

        @ApiModelProperty("分页行数")
        private Integer rows;

        @ApiModelProperty("关键字匹配")
        private String keyword;

        @ApiModelProperty("TEACHER:老师，STUDENT:学生")
        private String userType;

        @ApiModelProperty("机构小组ID")
        private Long tenantGroupId;

        @ApiModelProperty("结算方式")
        private ESettlementFrom settlementFrom;

        @ApiModelProperty("绑定状态，1：绑定。2：未绑定")
        private Boolean bindStatus;

        @ApiModelProperty("账号锁定状态，1：锁定，0：未锁定")
        private Boolean lockFlag;

        @ApiModelProperty("绑定开始时间")
        private Date bindStartTime;

        @ApiModelProperty("绑定结束时间")
        private Date bindEndTime;

        @ApiModelProperty("声部")
        private String subjectId;

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

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

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

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

    @Data
    @ApiModel(" UserTenantBindRecord-用户机构绑定解绑记录")
    public static class UserTenantBindRecord {

        @ApiModelProperty("")
        private Long id;


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


        @ApiModelProperty("TEACHER:老师，STUDENT:学生")
        private String userType;


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


        @ApiModelProperty("绑定状态:1:已绑定，0：未绑定")
        private Boolean bindStatus;


        @ApiModelProperty("绑定/解绑最新时间")
        private Date bindTime;

        @ApiModelProperty("姓名")
        private String userName;

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

        @ApiModelProperty("性别")
        private Integer gender;

        @ApiModelProperty("小组名称")
        private String tenantGroupName;

        @ApiModelProperty("小组名称")
        private String tenantGroupId;

        @ApiModelProperty("结算方式")
        private ESettlementFrom settlementFrom;

        @ApiModelProperty("锁定状态")
        private Boolean lockFlag;

        @ApiModelProperty("声部")
        private String subjectName;

        @ApiModelProperty("声部")
        private String subjectId;

        @ApiModelProperty("专辑状态，1：激活，0：为激活")
        private Boolean tenantAlbumActiveStatus;

        @ApiModelProperty("失效时间")
        private Date tenantAlbumExpireTime;

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

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

}