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

import com.alibaba.fastjson.JSON;
import com.yonge.cooleshow.common.enums.EStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Optional;

/**
 * 分享活动老师查询信息
 * Created by Eric.Shang on 2022/8/29.
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ActivityTeacherQuery implements Serializable {

    // 活动ID
    private Long activityId;
    // 声音ID
    private List<Long> subjectIdList;
    // 老师编号
    private Long id;
    // 老师手机号
    private String mobile;
    // 老师姓名或昵称
    private String name;
    // 锁定状态
    private Integer lockFlag;
    // 删除状态
    private Integer deleteFlag;
    // 新增搜索
    private Integer addType;

    // 活动开始时间
    private Long startTime;
    // 活动结束时间
    private Long endTime;
    private String resourceType;
    private String activityType;
    private Integer activityState;


    /**
     * 构建对象
     * @param recv 数据信息
     * @return ActivityTeacherQuery
     */
    public static ActivityTeacherQuery from(String recv) {

        return JSON.parseObject(recv, ActivityTeacherQuery.class);
    }

    public Integer getLockFlag() {
        return Optional.ofNullable(lockFlag).orElse(EStatus.DISABLE.getValue());
    }

    public Integer getDeleteFlag() {
        return Optional.ofNullable(deleteFlag).orElse(EStatus.DISABLE.getValue());
    }

    public Integer getAddType() {
        return Optional.ofNullable(addType).orElse(EStatus.DISABLE.getValue());
    }


    public ActivityTeacherQuery startTime(Long startTime) {
        this.startTime = startTime;
        return this;
    }

    public ActivityTeacherQuery endTime(Long endTime) {
        this.endTime = endTime;
        return this;
    }

    public ActivityTeacherQuery activityId(Long activityId) {
        this.activityId = activityId;
        return this;
    }

    public ActivityTeacherQuery resourceType(String resourceType) {
        this.resourceType = resourceType;
        return this;
    }

    public ActivityTeacherQuery activityType(String activityType) {
        this.activityType = activityType;
        return this;
    }

    public ActivityTeacherQuery activityState(Integer activityState) {
        this.activityState = activityState;
        return this;
    }
}
