using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using Tiku.Application.Tenancy;
using Tiku.Domain.Common;

namespace Tiku.Api.Contracts;

public sealed class SaveTenantFrontendConfigDraftDto
{
    public JsonElement Branding { get; set; } = JsonDefaults.Object();
    public JsonElement Theme { get; set; } = JsonDefaults.Object();
    public JsonElement Features { get; set; } = JsonDefaults.Object();
    public JsonElement Navigation { get; set; } = JsonDefaults.Array();
    public JsonElement HomeModules { get; set; } = JsonDefaults.Array();

    public TenantFrontendConfigDraft ToDraft() => new(
        Branding,
        Theme,
        Features,
        Navigation,
        HomeModules);
}

public sealed class PublishTenantFrontendConfigDto
{
    [Range(1, int.MaxValue)]
    public int ExpectedVersion { get; set; }
}
