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

namespace PlanTempus.Application.Features.Employees.Components;

public class EmployeeDetailViewViewComponent : ViewComponent
{
    private readonly ILocalizationService _localization;

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

    public IViewComponentResult Invoke(string key)
    {
        var employee = EmployeeDetailCatalog.Get(key);

        var model = new EmployeeDetailViewViewModel
        {
            EmployeeKey = employee.Key,
            BackText = _localization.Get("employees.detail.back"),
            SaveButtonText = _localization.Get("employees.detail.save"),
            TabGeneral = _localization.Get("employees.detail.tabs.general"),
            TabHours = _localization.Get("employees.detail.tabs.hours"),
            TabServices = _localization.Get("employees.detail.tabs.services"),
            TabSalary = _localization.Get("employees.detail.tabs.salary"),
            TabHR = _localization.Get("employees.detail.tabs.hr"),
            TabStats = _localization.Get("employees.detail.tabs.stats")
        };

        return View(model);
    }
}

public class EmployeeDetailViewViewModel
{
    public required string EmployeeKey { get; init; }
    public required string BackText { get; init; }
    public required string SaveButtonText { get; init; }
    public required string TabGeneral { get; init; }
    public required string TabHours { get; init; }
    public required string TabServices { get; init; }
    public required string TabSalary { get; init; }
    public required string TabHR { get; init; }
    public required string TabStats { get; init; }
}
