package com.yonge.cooleshow.biz.dal.dto.search;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yonge.cooleshow.biz.dal.enums.GenderEnum;
import com.yonge.cooleshow.common.enums.UserLockFlag;
import com.yonge.cooleshow.common.enums.YesOrNoEnum;
import com.yonge.toolset.base.page.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;

/**
 * @Author: liweifan
 * @Data: 2022/3/21 15:26
 */
@Data
@ApiModel(value = "StudentSearch", description = "学院管理查询")
public class StudentSearch extends QueryInfo{
    @ApiModelProperty(value = "学员编号/昵称/电话")
    private String search;
    @ApiModelProperty(value = "性别 0女 1男")
    private GenderEnum gender;
    @ApiModelProperty("学员声部 ")
    private String subjectId;
    @ApiModelProperty(value = "0-正常， 1-锁定")
    private UserLockFlag lockFlag;
    private YesOrNoEnum delFlag;
    @ApiModelProperty(value = "是否会员 0否 1是")
    private YesOrNoEnum isVip;

    @ApiModelProperty(value = "是否练习 0否 1是")
    private YesOrNoEnum trainFlag;

    @ApiModelProperty(value = "是否评测 0否 1是")
    private YesOrNoEnum evaluateFlag;

    @ApiModelProperty(value = "注册开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;
    @ApiModelProperty(value = "注册结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;


    @ApiModelProperty(value = "会员结束开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date vipStartTime;
    @ApiModelProperty(value = "会员结束结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date vipEndTime;

    @ApiModelProperty("用户状态")
    private String userStatus;

    @ApiModelProperty("隐藏标识")
    private Integer hideFlag;

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

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

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

    @ApiModelProperty("是否绑定机构，0：不绑定，1：绑定")
    private Integer bindTenant;

    @ApiModelProperty("机构购买专辑的购买记录ID")
    private Long tenantAlbumPurchaseId;

    @ApiModelProperty(value = "手机号码列表", hidden = true)
    private List<String> phoneList = new ArrayList<>();

    @ApiModelProperty(value = "排序方式",hidden = true)
    private String orderBy;

    public Date getVipStartTime() {
        return vipStartTime;
    }

    public void setVipStartTime(Date vipStartTime) {
        this.vipStartTime = vipStartTime;
    }

    public Date getVipEndTime() {
        return vipEndTime;
    }

    public void setVipEndTime(Date vipEndTime) {
        this.vipEndTime = vipEndTime;
    }

    public String getSearch() {
        return search;
    }

    public void setSearch(String search) {
        this.search = search;
    }

    public GenderEnum getGender() {
        return gender;
    }

    public void setGender(Object gender) {
        if(gender instanceof GenderEnum ){
            this.gender = (GenderEnum) gender;
        }else if (null != gender) {
            this.gender = GenderEnum.valueOf(Integer.parseInt(gender.toString()));
        }
    }

    public String getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(String subjectId) {
        this.subjectId = subjectId;
    }

    public UserLockFlag getLockFlag() {
        return lockFlag;
    }

    public void setLockFlag(UserLockFlag lockFlag) {
        this.lockFlag = lockFlag;
    }

    public YesOrNoEnum getIsVip() {
        return isVip;
    }

    public void setIsVip(Integer isVip) {
        this.isVip = YesOrNoEnum.valueOf(isVip);
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

	public String getUserStatus() {
		return userStatus;
	}

	public void setUserStatus(String userStatus) {
		this.userStatus = userStatus;
	}

	public YesOrNoEnum getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(YesOrNoEnum delFlag) {
		this.delFlag = delFlag;
	}

    public YesOrNoEnum getTrainFlag() {
        if (YesOrNoEnum.YES == trainFlag) {
            return trainFlag;
        }
        return null;
    }

    public void setTrainFlag(YesOrNoEnum trainFlag) {
        this.trainFlag = trainFlag;
    }

    public YesOrNoEnum getEvaluateFlag() {
        if (YesOrNoEnum.YES == evaluateFlag) {
            return evaluateFlag;
        }
        return null;
    }

    public void setEvaluateFlag(YesOrNoEnum evaluateFlag) {
        this.evaluateFlag = evaluateFlag;
    }

    public Integer getHideFlag() {
        return Optional.ofNullable(hideFlag).orElse(0);
    }

    public void setHideFlag(Integer hideFlag) {
        this.hideFlag = hideFlag;
    }
}
