using OmsorgCore.Application.Abstractions;

namespace OmsorgCore.Application.Services;

public enum DeleteValueListItemFailureReason
{
    ItemNotFound,
    InUse
}

public class DeleteValueListItemResult
{
    public bool Success { get; init; }
    public DeleteValueListItemFailureReason? FailureReason { get; init; }
    public IReadOnlyList<ValueListUsageEntry> Usages { get; init; } = Array.Empty<ValueListUsageEntry>();

    public static DeleteValueListItemResult Ok() => new() { Success = true };

    public static DeleteValueListItemResult Fail(DeleteValueListItemFailureReason reason, IReadOnlyList<ValueListUsageEntry>? usages = null) => new()
    {
        Success = false,
        FailureReason = reason,
        Usages = usages ?? Array.Empty<ValueListUsageEntry>()
    };
}
