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

namespace PlanTempus.Application.Features.Services.Components;

public class ServiceDetailViewViewComponent : ViewComponent
{
    private readonly ILocalizationService _localization;

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

    public IViewComponentResult Invoke(string key)
    {
        var service = ServiceDetailCatalog.Get(key);

        var model = new ServiceDetailViewViewModel
        {
            ServiceKey = service.Key,
            BackText = _localization.Get("services.detail.back"),
            SaveButtonText = _localization.Get("services.detail.save"),
            TabGeneral = _localization.Get("services.detail.tabs.general"),
            TabPrices = _localization.Get("services.detail.tabs.prices"),
            TabDuration = _localization.Get("services.detail.tabs.duration"),
            TabEmployees = _localization.Get("services.detail.tabs.employees"),
            TabAddons = _localization.Get("services.detail.tabs.addons"),
            TabRules = _localization.Get("services.detail.tabs.rules")
        };

        return View(model);
    }
}

public class ServiceDetailViewViewModel
{
    public required string ServiceKey { get; init; }
    public required string BackText { get; init; }
    public required string SaveButtonText { get; init; }
    public required string TabGeneral { get; init; }
    public required string TabPrices { get; init; }
    public required string TabDuration { get; init; }
    public required string TabEmployees { get; init; }
    public required string TabAddons { get; init; }
    public required string TabRules { get; init; }
}
