using TakeoutSaaS.Domain.Dictionary.Entities;
using TakeoutSaaS.Domain.Dictionary.Enums;

namespace TakeoutSaaS.Domain.Dictionary.Repositories;

/// <summary>
/// 字典标签覆盖仓储契约。
/// </summary>
public interface IDictionaryLabelOverrideRepository
{
    /// <summary>
    /// 根据 ID 获取覆盖配置。
    /// </summary>
    Task<DictionaryLabelOverride?> GetByIdAsync(long id, CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取指定字典项的覆盖配置。
    /// </summary>
    /// <param name="tenantId">租户 ID。</param>
    /// <param name="dictionaryItemId">字典项 ID。</param>
    /// <param name="cancellationToken">取消标记。</param>
    Task<DictionaryLabelOverride?> GetByItemIdAsync(long tenantId, long dictionaryItemId, CancellationToken cancellationToken = default);

    /// <summary>
    /// 获取租户的所有覆盖配置。
    /// </summary>
    /// <param name="tenantId">租户 ID。</param>
    /// <param name="overrideType">可选的覆盖类型过滤。</param>
    /// <param name="cancellationToken">取消标记。</param>
    Task<IReadOnlyList<DictionaryLabelOverride>> ListByTenantAsync(
        long tenantId,
        OverrideType? overrideType = null,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 批量获取多个字典项的覆盖配置。
    /// </summary>
    /// <param name="tenantId">租户 ID。</param>
    /// <param name="dictionaryItemIds">字典项 ID 列表。</param>
    /// <param name="cancellationToken">取消标记。</param>
    Task<IReadOnlyList<DictionaryLabelOverride>> GetByItemIdsAsync(
        long tenantId,
        IEnumerable<long> dictionaryItemIds,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// 新增覆盖配置。
    /// </summary>
    Task AddAsync(DictionaryLabelOverride entity, CancellationToken cancellationToken = default);

    /// <summary>
    /// 更新覆盖配置。
    /// </summary>
    Task UpdateAsync(DictionaryLabelOverride entity, CancellationToken cancellationToken = default);

    /// <summary>
    /// 删除覆盖配置。
    /// </summary>
    Task DeleteAsync(DictionaryLabelOverride entity, CancellationToken cancellationToken = default);

    /// <summary>
    /// 持久化更改。
    /// </summary>
    Task SaveChangesAsync(CancellationToken cancellationToken = default);
}
