package com.hzu.labbooking.domain.component;

import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author: yezihao
 * @since: 2021/6/15
 */
@Data
public class RecordTableKey {
    /**
     * 预约记录ID
     */
    private Long id;
    /**
     * 课程编号
     */
    private Long courseId;
    /**
     * 实验室编号
     */
    private Long labId;
    /**
     * 星期[1-7]
     */
    private Long day;
    /**
     * 节次[1-5(1-2,3-4,...)]
     */
    private Long time;

    /**
     * 预约用户ID
     */
    private Long userId;

    public RecordTableKey() {
    }

    public RecordTableKey(Long id, Long courseId, Long labId, Long day, Long time, Long userId) {
        this.id = id;
        this.courseId = courseId;
        this.labId = labId;
        this.day = day;
        this.time = time;
        this.userId = userId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RecordTableKey recordTableKey = (RecordTableKey) o;

        if (!id.equals(recordTableKey.id))
            return false;
        if (!courseId.equals(recordTableKey.courseId))
            return false;
        if (!day.equals(recordTableKey.day))
            return false;
        if (!time.equals(recordTableKey.time))
            return false;
        return labId.equals(recordTableKey.labId);
    }

    @Override
    public int hashCode() {
        int result = 0;
        result = 31 * result + (int) (id ^ (id >>> 32));
        result = 31 * result + (int) (courseId ^ (courseId >>> 32));
        result = 31 * result + (int) (labId ^ (labId >>> 32));
        result = 31 * result + (int) (day ^ (day >>> 32));
        result = 31 * result + (int) (time ^ (time >>> 32));
        return result;
    }
}
