package com.ssj.service.weixin.library.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.ssj.framework.weixin.util.DateUtil;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @author yrf
 * @time 2019/12/11 17:14
 */
public class StudentDTO implements Serializable {

    private static final long serialVersionUID = -6928898904834874111L;

    /**
     * 学生id
     */
    @JSONField(serialize = false)
    private String vipId;

    /**
     * 学生姓名
     */
    private String studentName;

    /**
     * 头像
     */
    private String imgUrl;

    /**
     * 服务截止时间
     */
    @JSONField(serialize = false)
    private Date endTime;

    /**
     * 服务截止时间(yyyy-MM-dd)
     */
    private String serviceTime;

    /**
     * 批改方式类型，1平台，2机构，3家长
     */
    @JSONField(serialize = false)
    private Integer correctType;

    /**
     * 卡类型
     */
    @JSONField(serialize = false)
    private String type;

    @JSONField(serialize = false)
    private Integer serviceSort;

    @JSONField(serialize = false)
    private Date createTime;

    public String getVipId() {
        return vipId;
    }

    public void setVipId(String vipId) {
        this.vipId = vipId;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public Date getEndTime() {
        return endTime;
    }

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

    public String getServiceTime() {
        if ("C025".equals(type)) {
            return "无";
        }

        if (StringUtils.isBlank(serviceTime)) {
            serviceTime = DateUtil.format_yyyyMMdd(endTime);
        }

        return serviceTime;
    }

    public void setServiceTime(String serviceTime) {
        this.serviceTime = serviceTime;
    }

    public Integer getCorrectType() {
        return correctType;
    }

    public void setCorrectType(Integer correctType) {
        this.correctType = correctType;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getServiceSort() {
        return serviceSort;
    }

    public void setServiceSort(Integer serviceSort) {
        this.serviceSort = serviceSort;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        StudentDTO that = (StudentDTO) o;
        return Objects.equals(vipId, that.getVipId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(vipId);
    }

    @Override
    public String toString() {
        return "StudentDTO{" +
                "studentName='" + studentName + '\'' +
                ", imgUrl='" + imgUrl + '\'' +
                ", serviceTime=" + serviceTime +
                '}';
    }
}
