using MemberCenter.Application.Models.Admin;

namespace MemberCenter.Web.Areas.Admin.Models;

public sealed class TenantDetailViewModel
{
    public required TenantDto Tenant { get; set; }

    public IReadOnlyList<TenantNewsletterSummaryViewModel> NewsletterLists { get; set; } = Array.Empty<TenantNewsletterSummaryViewModel>();

    public IReadOnlyList<TenantManagerItemViewModel> Managers { get; set; } = Array.Empty<TenantManagerItemViewModel>();

    public bool CanManageManagers { get; set; }

    public int ActiveSubscriptionCount => NewsletterLists.Sum(list => list.ActiveSubscriptionCount);
}

public sealed class TenantNewsletterSummaryViewModel
{
    public Guid Id { get; set; }

    public string Name { get; set; } = string.Empty;

    public string Status { get; set; } = string.Empty;

    public int ActiveSubscriptionCount { get; set; }
}

public sealed class TenantManagerItemViewModel
{
    public Guid UserId { get; set; }

    public string Email { get; set; } = string.Empty;

    public string DisplayName { get; set; } = string.Empty;

    public DateTimeOffset CreatedAt { get; set; }
}
