using JSMR.Application.Scanning.Contracts;
using JSMR.Domain.Enums;

namespace JSMR.Application.Scanning.Ports;

public interface IVoiceWorkUpdater
{
    Task<VoiceWorkUpsertResult[]> UpsertAsync(IReadOnlyCollection<VoiceWorkIngest> ingests, CancellationToken cancellationToken);
}

public class VoiceWorkUpsertResult
{
    public string ProductId { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public int? VoiceWorkId { get; set; }
    public VoiceWorkStatus UpdateStatus { get; set; }
    public ICollection<VoiceWorkUpsertIssue> Issues { get; } = [];
    public VoiceWorkUpsertStatus Status { get; set; } = VoiceWorkUpsertStatus.Unchanged;
}

public record VoiceWorkUpsertIssue(
    string Message,
    VoiceWorkUpsertIssueSeverity Severity
);

public enum VoiceWorkUpsertIssueSeverity
{
    Information,
    Warning,
    Error
}

public enum VoiceWorkUpsertStatus
{
    Unchanged,
    Inserted,
    Updated,
    Skipped
}