namespace BackOffice.Services.DiscountCategory;

public interface IDiscountCategoryService
{
    Task<List<DiscountCategoryDto>> GetCategoriesAsync(long? parentCategoryId = null, bool? isActive = null);
    Task<DiscountCategoryDto?> GetByIdAsync(long id);
    Task<long> CreateAsync(CreateDiscountCategoryDto dto);
    Task UpdateAsync(long id, UpdateDiscountCategoryDto dto);
    Task DeleteAsync(long id);
}

public class DiscountCategoryDto
{
    public long Id { get; set; }
    public string Name { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public string? Description { get; set; }
    public string? ImagePath { get; set; }
    public long? ParentCategoryId { get; set; }
    public int SortOrder { get; set; }
    public bool IsActive { get; set; }
    public int ProductCount { get; set; }
    
    // For UI tree view
    public bool IsExpanded { get; set; } = false;
    public List<DiscountCategoryDto> Children { get; set; } = new();
}

public class CreateDiscountCategoryDto
{
    public string Name { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public string? Description { get; set; }
    public string? ImagePath { get; set; }
    public long? ParentCategoryId { get; set; }
    public int SortOrder { get; set; } = 0;
    public bool IsActive { get; set; } = true;
}

public class UpdateDiscountCategoryDto
{
    public string Name { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public string? Description { get; set; }
    public string? ImagePath { get; set; }
    public long? ParentCategoryId { get; set; }
    public int SortOrder { get; set; }
    public bool IsActive { get; set; }
}
