namespace TaxBaik.Application.Services;

using TaxBaik.Domain.Entities;
using TaxBaik.Domain.Interfaces;

public class ConsultationService(IConsultationRepository repository)
{
    public static readonly string[] Results =
        ["상담 중", "계약 완료", "보류", "거절", "완료"];

    public async Task<IEnumerable<Consultation>> GetByClientIdAsync(int clientId, CancellationToken ct = default) =>
        await repository.GetByClientIdAsync(clientId, ct);

    public async Task<int> CreateAsync(Consultation consultation, CancellationToken ct = default)
    {
        if (string.IsNullOrWhiteSpace(consultation.Summary))
            throw new ValidationException("상담 내용을 입력하세요.");
        if (consultation.ClientId <= 0)
            throw new ValidationException("고객을 선택하세요.");
        return await repository.CreateAsync(consultation, ct);
    }

    public async Task DeleteAsync(int id, CancellationToken ct = default) =>
        await repository.DeleteAsync(id, ct);
}
