package com.astalange.core.entity;

import jakarta.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "saison")
public class Saison {

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

    @Column(nullable = false)
    private String nom;

    @Column(name = "est_active", nullable = false)
    private Boolean estActive = false;

    @Column(name = "inscriptions_ouvertes", nullable = false)
    private Boolean inscriptionsOuvertes = false;

    // Getters and Setters

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public Boolean getEstActive() {
        return estActive;
    }

    public void setEstActive(Boolean estActive) {
        this.estActive = estActive;
    }

    public Boolean getInscriptionsOuvertes() {
        return inscriptionsOuvertes != null ? inscriptionsOuvertes : false;
    }

    public void setInscriptionsOuvertes(Boolean inscriptionsOuvertes) {
        this.inscriptionsOuvertes = inscriptionsOuvertes;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        Saison saison = (Saison) o;
        return Objects.equals(id, saison.id);
    }

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