using OmsorgCore.Domain.Entities;

namespace OmsorgCore.Application.Abstractions;

public interface IValueListRepository
{
    Task<IReadOnlyList<ValueList>> GetAllListsAsync(CancellationToken cancellationToken = default);
    Task<ValueList?> GetListByKeyAsync(string key, CancellationToken cancellationToken = default);

    Task<IReadOnlyList<ValueListItem>> GetItemsAsync(string key, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<string>> GetActiveValuesAsync(string key, CancellationToken cancellationToken = default);
    Task<ValueListItem?> GetItemByIdAsync(Guid id, CancellationToken cancellationToken = default);
    Task<ValueListItem?> GetInitialItemAsync(string key, CancellationToken cancellationToken = default);

    Task AddItemAsync(ValueListItem item, CancellationToken cancellationToken = default);
    Task UpdateItemAsync(ValueListItem item, CancellationToken cancellationToken = default);
    Task RemoveItemAsync(ValueListItem item, CancellationToken cancellationToken = default);

    Task<bool> CanTransitionAsync(Guid fromItemId, Guid toItemId, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<ValueListItemTransition>> GetTransitionsAsync(string key, CancellationToken cancellationToken = default);
    Task ReplaceTransitionsAsync(string key, IEnumerable<(Guid FromItemId, Guid ToItemId)> transitions, CancellationToken cancellationToken = default);
    Task<ValueListItemTransition?> GetSelfServiceTransitionAsync(Guid fromItemId, CancellationToken cancellationToken = default);
    Task<ValueListItemTransition?> GetTransitionAsync(Guid fromItemId, Guid toItemId, CancellationToken cancellationToken = default);

    Task SaveChangesAsync(CancellationToken cancellationToken = default);
}
