using FlatRender.ContentSvc.Domain.Enums;

namespace FlatRender.ContentSvc.Domain.Entities;

public class Blog
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }
    public BlogKind Kind { get; set; } = BlogKind.Blog;

    public string Slug { get; set; } = default!;
    public string Title { get; set; } = default!;
    public string? ShortDescription { get; set; }
    public string Content { get; set; } = default!;

    public string? MetaTitle { get; set; }
    public string? MetaDescription { get; set; }
    public string? MetaKeywords { get; set; }
    public bool IncludeInSiteMap { get; set; } = true;

    public string? Image { get; set; }
    public string? Cover { get; set; }

    public Guid? AuthorUserId { get; set; }
    public string? AuthorDisplayName { get; set; }

    public bool IsPublished { get; set; }
    public DateTime? PublishDate { get; set; }

    public long ViewCount { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
    public DateTime? DeletedAt { get; set; }

    public ICollection<Comment> Comments { get; set; } = [];
}

public class Comment
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }
    public Guid UserId { get; set; }

    public Guid? BlogId { get; set; }
    public Blog? Blog { get; set; }
    public Guid? ContainerId { get; set; }
    public ProjectContainer? Container { get; set; }
    public Guid? ParentCommentId { get; set; }
    public Comment? ParentComment { get; set; }

    public string Content { get; set; } = default!;
    public decimal? Rate { get; set; }

    public bool IsApproved { get; set; }
    public bool IsPinned { get; set; }

    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
    public DateTime? DeletedAt { get; set; }

    public ICollection<Comment> Replies { get; set; } = [];
}

public class HomePageEvent
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }

    public string? Title { get; set; }
    public string? Subtitle { get; set; }
    public string? Description { get; set; }
    public string? Badge { get; set; }
    public string? BadgeClass { get; set; }
    public string? ButtonText { get; set; }
    public string? ButtonUrl { get; set; }
    public string? ButtonClass { get; set; }
    public string? Color { get; set; }
    public string? BackgroundColor { get; set; }
    public string? TextColor { get; set; }
    public string? Image { get; set; }

    public bool IsActive { get; set; } = true;
    public int Sort { get; set; }
    public DateTime? StartsAt { get; set; }
    public DateTime? EndsAt { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

public class NewSlide
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }

    public string? Keyword { get; set; }
    public string? Title { get; set; }
    public string? Image { get; set; }
    public string? Parameter { get; set; }
    public SlideType SlideType { get; set; } = SlideType.Hero;
    public DateTime? ExpireDate { get; set; }

    public int Sort { get; set; }
    public bool IsActive { get; set; } = true;
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

public class InternalRoute
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }

    public string? Name { get; set; }
    public string? Image { get; set; }
    public string Slug { get; set; } = default!;
    public int Priority { get; set; } = 5;
    public DateTime? LastDate { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

public class CustomRoute
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }

    public string Target { get; set; } = default!;
    public string Destination { get; set; } = default!;
    public int RedirectCode { get; set; } = 301;
    public bool IsActive { get; set; } = true;
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

public class WebsiteSetting
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }

    public string Key { get; set; } = default!;
    public string Value { get; set; } = "{}";
    public string? Description { get; set; }
    public bool IsSecret { get; set; }
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

public class LearnArticle
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }

    public string Title { get; set; } = default!;
    public string? Body { get; set; }
    public string? DemoUrl { get; set; }
    public string? Mode { get; set; }

    public int Sort { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

public class Training
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid? TenantId { get; set; }

    public string Title { get; set; } = default!;
    public string? Description { get; set; }
    public string? VideoUrl { get; set; }
    public string? ThumbnailUrl { get; set; }

    public int Sort { get; set; }
    public bool IsPublished { get; set; } = true;
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

public class FavoriteFolder
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid UserId { get; set; }
    public Guid TenantId { get; set; }

    public string Name { get; set; } = default!;
    public string? Description { get; set; }

    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

    public ICollection<FavoriteContainer> Containers { get; set; } = [];
}

public class FavoriteContainer
{
    public Guid Id { get; set; } = Guid.NewGuid();
    public Guid UserId { get; set; }
    public Guid TenantId { get; set; }
    public Guid ContainerId { get; set; }
    public ProjectContainer Container { get; set; } = default!;
    public Guid? FolderId { get; set; }
    public FavoriteFolder? Folder { get; set; }

    public string? Note { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
