using IamService.Domain.SeedWork;

namespace IamService.Domain.AggregatesModel.OrganizationAggregate;

/// <summary>
/// EN: Interface for Organization repository.
/// VI: Interface cho repository Organization.
/// </summary>
public interface IOrganizationRepository : IRepository<Organization>
{
    /// <summary>
    /// EN: Get organization by ID with optional includes.
    /// VI: Lấy tổ chức theo ID với optional includes.
    /// </summary>
    Task<Organization?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get organization by slug.
    /// VI: Lấy tổ chức theo slug.
    /// </summary>
    Task<Organization?> GetBySlugAsync(string slug, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get organization hierarchy (parent and children).
    /// VI: Lấy cây phân cấp tổ chức (cha và con).
    /// </summary>
    Task<IEnumerable<Organization>> GetHierarchyAsync(Guid rootId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get all child organizations of a parent.
    /// VI: Lấy tất cả tổ chức con của một tổ chức cha.
    /// </summary>
    Task<IEnumerable<Organization>> GetChildrenAsync(Guid parentId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Check if slug is unique.
    /// VI: Kiểm tra slug có duy nhất không.
    /// </summary>
    Task<bool> IsSlugUniqueAsync(string slug, Guid? excludeId = null, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Add a new organization.
    /// VI: Thêm tổ chức mới.
    /// </summary>
    Organization Add(Organization organization);

    /// <summary>
    /// EN: Update an existing organization.
    /// VI: Cập nhật tổ chức hiện có.
    /// </summary>
    void Update(Organization organization);

    /// <summary>
    /// EN: Delete an organization.
    /// VI: Xóa tổ chức.
    /// </summary>
    void Delete(Organization organization);
}
