File size: 1,123 Bytes
de8b914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
namespace SCM.Domain.Qualidade;

/// <summary>Agente com a contagem de programações associadas (read model de listagem).</summary>
public readonly record struct AgenteComContagem(Agente Agente, int QtdProgramacoes);

/// <summary>Contrato de persistência de agentes de qualidade. Implementado em SCM.Infrastructure.</summary>
public interface IAgenteRepository
{
    Task<IReadOnlyList<AgenteComContagem>> GetAllAsync(CancellationToken ct = default);

    Task<Agente?> GetByIdAsync(Guid id, CancellationToken ct = default);

    Task<bool> CodigoExistsAsync(string codigo, Guid? excludeId = null, CancellationToken ct = default);

    Task<bool> CpfExistsAsync(string cpf, Guid? excludeId = null, CancellationToken ct = default);

    /// <summary>Quantidade de programações associadas ao agente (trava de exclusão).</summary>
    Task<int> ContarProgramacoesAsync(Guid id, CancellationToken ct = default);

    Task AddAsync(Agente agente, CancellationToken ct = default);

    Task UpdateAsync(Agente agente, CancellationToken ct = default);

    Task<bool> DeleteAsync(Guid id, CancellationToken ct = default);
}