package com.magistr.app.model;

import jakarta.persistence.*;

import java.time.LocalDate;
import java.time.Instant;

@Entity
@Table(name = "schedule_overrides")
public class ScheduleOverride {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne(optional = false)
    @JoinColumn(name = "base_rule_slot_id", nullable = false)
    private ScheduleRuleSlot baseRuleSlot;

    @Column(name = "lesson_date", nullable = false)
    private LocalDate lessonDate;

    @Column(name = "target_lesson_date")
    private LocalDate targetLessonDate;

    @Column(nullable = false, length = 20)
    private String action;

    @ManyToOne
    @JoinColumn(name = "new_time_slot_id")
    private TimeSlot newTimeSlot;

    @ManyToOne
    @JoinColumn(name = "new_classroom_id")
    private Classroom newClassroom;

    @ManyToOne
    @JoinColumn(name = "new_teacher_id")
    private User newTeacher;

    @Column(name = "new_lesson_format", length = 30)
    private String newLessonFormat;

    @Column(columnDefinition = "TEXT")
    private String comment;

    @Column(name = "created_by")
    private Long createdBy;

    @Column(name = "created_at", nullable = false)
    private Instant createdAt = Instant.now();

    public Long getId() {
        return id;
    }

    public ScheduleRuleSlot getBaseRuleSlot() {
        return baseRuleSlot;
    }

    public void setBaseRuleSlot(ScheduleRuleSlot baseRuleSlot) {
        this.baseRuleSlot = baseRuleSlot;
    }

    public LocalDate getLessonDate() {
        return lessonDate;
    }

    public void setLessonDate(LocalDate lessonDate) {
        this.lessonDate = lessonDate;
    }

    public LocalDate getTargetLessonDate() {
        return targetLessonDate;
    }

    public void setTargetLessonDate(LocalDate targetLessonDate) {
        this.targetLessonDate = targetLessonDate;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public TimeSlot getNewTimeSlot() {
        return newTimeSlot;
    }

    public void setNewTimeSlot(TimeSlot newTimeSlot) {
        this.newTimeSlot = newTimeSlot;
    }

    public Classroom getNewClassroom() {
        return newClassroom;
    }

    public void setNewClassroom(Classroom newClassroom) {
        this.newClassroom = newClassroom;
    }

    public User getNewTeacher() {
        return newTeacher;
    }

    public void setNewTeacher(User newTeacher) {
        this.newTeacher = newTeacher;
    }

    public String getNewLessonFormat() {
        return newLessonFormat;
    }

    public void setNewLessonFormat(String newLessonFormat) {
        this.newLessonFormat = newLessonFormat;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Long getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
    }

    public Instant getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Instant createdAt) {
        this.createdAt = createdAt;
    }
}
