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.ETenantUnBindAuditStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Optional;

/**
 * 机构解绑申请记录
 * 2023-07-21 17:32:49
 */
@ApiModel(value = "TenantUnbindRecordWrapper对象", description = "机构解绑申请记录查询对象")
public class TenantUnbindRecordWrapper {

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantUnbindRecordQuery-机构解绑申请记录")
    public static class TenantUnbindRecordQuery implements QueryInfo {

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

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

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

        @ApiModelProperty("省份")
        private String provinceCode;

        @ApiModelProperty("城市")
        private String cityCode;

        @ApiModelProperty("区域")
        private String regionCode;

        @ApiModelProperty("用户类型，TEACHER/STUDENT")
        private String userType;

        @ApiModelProperty("审核状态 DOING、审核中 PASS、通过 UNPASS、不通过,取消：CANCEL,关闭：CLOSE")
        private ETenantUnBindAuditStatus status;

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

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

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

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantUnbindRecord-机构解绑申请记录")
    public static class TenantUnbindRecord {

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

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

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

        @ApiModelProperty("机构联系人")
        private String tenantUserName;

        @ApiModelProperty("机构人手机号")
        private String tenantPhone;

        @ApiModelProperty("省码")
        private Integer provinceCode;

        @ApiModelProperty("市码")
        private Integer cityCode;

        @ApiModelProperty("区码")
        private Integer regionCode;

        @ApiModelProperty("省")
        private String provinceName;

        @ApiModelProperty("市")
        private String cityName;

        @ApiModelProperty("区")
        private String regionName;

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

        @ApiModelProperty("申请人姓名")
        private String userName;

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

        @ApiModelProperty("用户类型")
        private String userType;

        @ApiModelProperty("解绑理由")
        private String unbindReason;

        @ApiModelProperty("审核状态 DOING、审核中 PASS、通过 UNPASS、不通过,撤销：CANCEL,关闭：CLOSE")
        private ETenantUnBindAuditStatus status;

        @ApiModelProperty("审核人")
        private Long verifyUserId;

        @ApiModelProperty("审核理由")
        private String reason;

        @ApiModelProperty("后台介入时间")
        private Date interveneTime;

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

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

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

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

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


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

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

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" 审核参数模型")
    public static class Audio {

        @ApiModelProperty("审核记录的ID")
        @NotNull
        private Long id;

        @ApiModelProperty("审核状态,true:通过，false：驳回")
        @NotNull
        private Boolean status;

        @ApiModelProperty("审核理由")
        private String reason;
    }



    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel("机构主动解绑老师")
    public static class Unbind {

        @ApiModelProperty("解绑的用户ID")
        @NotNull
        private Long userId;

        @ApiModelProperty("审核理由")
        @NotNull
        private String reason;
    }

}