package com.hzu.labbooking.domain.component;

import lombok.Data;

/**
 * @author: yezihao
 * @since: 2021/6/15
 */
@Data
public class RecordKey {

    /**
     * 用户编号
     */
    private Long userId;
    /**
     * 课程编号
     */
    private Long courseId;
    /**
     * 预约状态
     */
    private Long status;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        //if (!super.equals(o)) return false;
        RecordKey recordKey = (RecordKey) o;
        if (!userId.equals(recordKey.userId)) {
            return false;
        }
        if (!status.equals(recordKey.status)) {
            return false;
        }
        return courseId.equals(recordKey.courseId);
    }

    @Override
    public int hashCode() {
        int result = 0;
        result = 31 * result + (int) (status ^ (status >>> 32));
        result = 31 * result + (int) (userId ^ (userId >>> 32));
        result = 31 * result + (int) (courseId ^ (courseId >>> 32));
        return result;
    }

    public RecordKey() {
    }

    public RecordKey(Long userId, Long courseId, Long status) {
        this.userId = userId;
        this.courseId = courseId;
        this.status = status;
    }

}
