namespace BackOffice.Services.Content;

public interface ISitePageService
{
    Task<List<SitePageSummaryDto>> GetAllAsync();
    Task<SitePageDetailsDto?> GetByIdAsync(long id);
    Task<long> CreateAsync(SitePageCreateDto dto);
    Task UpdateAsync(long id, SitePageEditDto dto);
    Task DeleteAsync(long id);
    Task<long> CreateSectionAsync(SitePageSectionEditDto dto);
    Task UpdateSectionAsync(long id, SitePageSectionEditDto dto);
    Task DeleteSectionAsync(long id);
    Task ReorderSectionsAsync(List<SectionSortItemDto> items);
}

public class SitePageSummaryDto
{
    public long Id { get; set; }
    public string PageKey { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public bool IsActive { get; set; }
    public int SectionCount { get; set; }
    public DateTime LastModified { get; set; }
}

public class SitePageDetailsDto
{
    public long Id { get; set; }
    public string PageKey { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public string? MetaDescription { get; set; }
    public string? HeroTitle { get; set; }
    public string? HeroSubtitle { get; set; }
    public string? HeroImagePath { get; set; }
    public bool IsActive { get; set; }
    public List<SitePageSectionItemDto> Sections { get; set; } = new();
}

public class SitePageSectionItemDto
{
    public long Id { get; set; }
    public string SectionKey { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public string? Subtitle { get; set; }
    public string? HtmlContent { get; set; }
    public string? IconName { get; set; }
    public string? ImagePath { get; set; }
    public string? ImageThumbnailPath { get; set; }
    public int SortOrder { get; set; }
    public bool IsActive { get; set; }
    public string? ExtraData { get; set; }
}

public class SitePageEditDto
{
    public string Title { get; set; } = string.Empty;
    public string? MetaDescription { get; set; }
    public string? HeroTitle { get; set; }
    public string? HeroSubtitle { get; set; }
    public string? HeroImagePath { get; set; }
    public bool IsActive { get; set; } = true;

    // Image upload properties
    public byte[]? ImageFile { get; set; }
    public string? ImageMime { get; set; }
    public string? ImageFileName { get; set; }
}

public class SitePageCreateDto
{
    public string PageKey { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public string? MetaDescription { get; set; }
    public string? HeroTitle { get; set; }
    public string? HeroSubtitle { get; set; }
    public bool IsActive { get; set; } = true;

    // Image upload properties
    public byte[]? ImageFile { get; set; }
    public string? ImageMime { get; set; }
    public string? ImageFileName { get; set; }
}

public class SitePageSectionEditDto
{
    public long SitePageId { get; set; }
    public string SectionKey { get; set; } = string.Empty;
    public string Title { get; set; } = string.Empty;
    public string? Subtitle { get; set; }
    public string? HtmlContent { get; set; }
    public string? IconName { get; set; }
    public string? ImagePath { get; set; }
    public string? ImageThumbnailPath { get; set; }
    public int SortOrder { get; set; }
    public bool IsActive { get; set; } = true;
    public string? ExtraData { get; set; }

    // Image upload properties
    public byte[]? ImageFile { get; set; }
    public string? ImageMime { get; set; }
    public string? ImageFileName { get; set; }
}

public class SectionSortItemDto
{
    public long Id { get; set; }
    public int SortOrder { get; set; }
}
