using Microsoft.AspNetCore.Mvc;
using PlanTempus.Application.Features.Localization.Services;

namespace PlanTempus.Application.Features.Customers.Components;

public class CustomerDetailViewViewComponent : ViewComponent
{
    private readonly ILocalizationService _localization;

    public CustomerDetailViewViewComponent(ILocalizationService localization)
    {
        _localization = localization;
    }

    public IViewComponentResult Invoke(string customerId)
    {
        var customer = CustomerDetailCatalog.Get(customerId);

        var model = new CustomerDetailViewViewModel
        {
            CustomerId = customer.Id,
            CustomerName = customer.Header.Name,
            BackText = _localization.Get("customers.detail.back"),
            DeleteButtonText = _localization.Get("customers.detail.delete"),
            SaveButtonText = _localization.Get("customers.detail.save"),
            TabOverview = _localization.Get("customers.detail.tabs.overview"),
            TabEconomy = _localization.Get("customers.detail.tabs.economy"),
            TabStatistics = _localization.Get("customers.detail.tabs.statistics"),
            TabJournal = _localization.Get("customers.detail.tabs.journal"),
            TabAppointments = _localization.Get("customers.detail.tabs.appointments"),
            TabGiftcards = _localization.Get("customers.detail.tabs.giftcards"),
            TabActivity = _localization.Get("customers.detail.tabs.activitylog")
        };

        return View(model);
    }
}

public class CustomerDetailViewViewModel
{
    public required string CustomerId { get; init; }
    public required string CustomerName { get; init; }
    public required string BackText { get; init; }
    public required string DeleteButtonText { get; init; }
    public required string SaveButtonText { get; init; }
    public required string TabOverview { get; init; }
    public required string TabEconomy { get; init; }
    public required string TabStatistics { get; init; }
    public required string TabJournal { get; init; }
    public required string TabAppointments { get; init; }
    public required string TabGiftcards { get; init; }
    public required string TabActivity { get; init; }
}
