content: package br.com.alevhvm.adotai.agendamento.model;
  
  import java.io.Serializable;
  import java.time.LocalDateTime;
  
  import br.com.alevhvm.adotai.agendamento.enums.StatusAgendamento;
  import br.com.alevhvm.adotai.animal.model.Animal;
  import br.com.alevhvm.adotai.ong.model.Ong;
  import br.com.alevhvm.adotai.usuario.model.Usuario;
  import jakarta.persistence.Column;
  import jakarta.persistence.Entity;
  import jakarta.persistence.EnumType;
  import jakarta.persistence.Enumerated;
  import jakarta.persistence.FetchType;
  import jakarta.persistence.GeneratedValue;
  import jakarta.persistence.GenerationType;
  import jakarta.persistence.Id;
  import jakarta.persistence.JoinColumn;
  import jakarta.persistence.ManyToOne;
  import jakarta.persistence.Table;
  import jakarta.persistence.UniqueConstraint;
  import lombok.EqualsAndHashCode;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import lombok.Setter;
  
  @Getter
  @Setter
  @NoArgsConstructor
  @EqualsAndHashCode(callSuper = false)
  @Entity
  @Table(name = "agendamento",
          uniqueConstraints = @UniqueConstraint(columnNames = {"animal_id", "data_hora"})) //evita agendamentos simultâneos para o mesmo animal.
  public class Agendamento implements Serializable {
      
      @Id
      @Column(name = "id", nullable = false, unique = true)
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn(name = "animal_id", nullable = false)
      private Animal animal;
  
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn(name = "usuario_id", nullable = false)
      private Usuario usuario;
  
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn(name = "ong_id", nullable = false)
      private Ong ong;
  
      @Column(name = "data_hora", nullable = false)
      private LocalDateTime dataHora;
  
      @Enumerated(EnumType.STRING)
      @Column(name = "status", nullable = false)
      private StatusAgendamento status;
  
      @Column(name = "observacao", nullable = false, length = 255)
      private String observacao;
  }
  