using TakeoutSaaS.Domain.Identity.Entities;
using TakeoutSaaS.Domain.Identity.Enums;

namespace TakeoutSaaS.Domain.Identity.Repositories;

/// <summary>
/// 菜单仓储。
/// </summary>
public interface IMenuRepository
{
    /// <summary>
    /// 按门户类型获取菜单列表。
    /// </summary>
    Task<IReadOnlyList<MenuDefinition>> GetByPortalAsync(PortalType portal, CancellationToken cancellationToken = default);

    /// <summary>
    /// 根据 ID 查询菜单。
    /// </summary>
    Task<MenuDefinition?> FindByIdAsync(long id, CancellationToken cancellationToken = default);

    /// <summary>
    /// 新增菜单。
    /// </summary>
    Task AddAsync(MenuDefinition menu, CancellationToken cancellationToken = default);

    /// <summary>
    /// 更新菜单。
    /// </summary>
    Task UpdateAsync(MenuDefinition menu, CancellationToken cancellationToken = default);

    /// <summary>
    /// 删除菜单。
    /// </summary>
    Task DeleteAsync(long id, CancellationToken cancellationToken = default);

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