package dev.lions.unionflow.server.repository;

import dev.lions.unionflow.server.entity.ProcesVerbal;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.List;
import java.util.UUID;

/** Repository des procès-verbaux AG/CA. */
@ApplicationScoped
public class ProcesVerbalRepository implements PanacheRepositoryBase<ProcesVerbal, UUID> {

  public List<ProcesVerbal> findByOrganisation(UUID organisationId) {
    return list("organisationId = ?1 ORDER BY dateSeance DESC", organisationId);
  }

  public List<ProcesVerbal> findByOrganisationAndType(UUID organisationId, String typeSeance) {
    return list("organisationId = ?1 AND typeSeance = ?2 ORDER BY dateSeance DESC",
        organisationId, typeSeance);
  }

  public List<ProcesVerbal> findBrouillons(UUID organisationId) {
    return list("organisationId = ?1 AND statut = 'BROUILLON'", organisationId);
  }
}
