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

namespace PlanTempus.Application.Features.Employees.Components;

public class EmployeeDetailGeneralViewComponent : ViewComponent
{
    private readonly ILocalizationService _localization;

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

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

        var model = new EmployeeDetailGeneralViewModel
        {
            // Contact
            Name = employee.Name,
            Email = employee.Email,
            Phone = employee.Phone,
            Address = employee.Address,
            PostalCity = employee.PostalCity,

            // Personal
            BirthDate = employee.BirthDate,
            EmergencyContact = employee.EmergencyContact,
            EmergencyPhone = employee.EmergencyPhone,

            // Employment
            EmploymentDate = employee.EmploymentDate,
            Position = employee.Position,
            EmploymentType = employee.EmploymentType,
            HoursPerWeek = employee.HoursPerWeek,

            // Labels
            LabelContact = _localization.Get("employees.detail.contact"),
            LabelPersonal = _localization.Get("employees.detail.personal"),
            LabelEmployment = _localization.Get("employees.detail.employment"),
            LabelFullName = _localization.Get("employees.detail.fullname"),
            LabelEmail = _localization.Get("employees.detail.email"),
            LabelPhone = _localization.Get("employees.detail.phone"),
            LabelAddress = _localization.Get("employees.detail.address"),
            LabelPostalCity = _localization.Get("employees.detail.postalcity"),
            LabelBirthDate = _localization.Get("employees.detail.birthdate"),
            LabelEmergencyContact = _localization.Get("employees.detail.emergencycontact"),
            LabelEmergencyPhone = _localization.Get("employees.detail.emergencyphone"),
            LabelEmploymentDate = _localization.Get("employees.detail.employmentdate"),
            LabelPosition = _localization.Get("employees.detail.position"),
            LabelEmploymentType = _localization.Get("employees.detail.employmenttype"),
            LabelHoursPerWeek = _localization.Get("employees.detail.hoursperweek"),

            // Settings
            LabelSettings = _localization.Get("employees.detail.settings.label"),
            SettingShowInBooking = _localization.Get("employees.detail.settings.showinbooking.label"),
            SettingShowInBookingDesc = _localization.Get("employees.detail.settings.showinbooking.desc"),
            SettingSmsReminders = _localization.Get("employees.detail.settings.smsreminders.label"),
            SettingSmsRemindersDesc = _localization.Get("employees.detail.settings.smsreminders.desc"),
            SettingEditCalendar = _localization.Get("employees.detail.settings.editcalendar.label"),
            SettingEditCalendarDesc = _localization.Get("employees.detail.settings.editcalendar.desc"),
            ToggleYes = _localization.Get("common.yes"),
            ToggleNo = _localization.Get("common.no"),

            // Notifications
            LabelNotifications = _localization.Get("employees.detail.notifications.label"),
            NotificationsIntro = _localization.Get("employees.detail.notifications.intro"),
            NotifOnlineBooking = _localization.Get("employees.detail.notifications.onlinebooking"),
            NotifManualBooking = _localization.Get("employees.detail.notifications.manualbooking"),
            NotifCancellation = _localization.Get("employees.detail.notifications.cancellation"),
            NotifWaitlist = _localization.Get("employees.detail.notifications.waitlist"),
            NotifDailySummary = _localization.Get("employees.detail.notifications.dailysummary")
        };

        return View(model);
    }
}

public class EmployeeDetailGeneralViewModel
{
    // Contact
    public required string Name { get; init; }
    public required string Email { get; init; }
    public required string Phone { get; init; }
    public required string Address { get; init; }
    public required string PostalCity { get; init; }

    // Personal
    public required string BirthDate { get; init; }
    public required string EmergencyContact { get; init; }
    public required string EmergencyPhone { get; init; }

    // Employment
    public required string EmploymentDate { get; init; }
    public required string Position { get; init; }
    public required string EmploymentType { get; init; }
    public required string HoursPerWeek { get; init; }

    // Labels
    public required string LabelContact { get; init; }
    public required string LabelPersonal { get; init; }
    public required string LabelEmployment { get; init; }
    public required string LabelFullName { get; init; }
    public required string LabelEmail { get; init; }
    public required string LabelPhone { get; init; }
    public required string LabelAddress { get; init; }
    public required string LabelPostalCity { get; init; }
    public required string LabelBirthDate { get; init; }
    public required string LabelEmergencyContact { get; init; }
    public required string LabelEmergencyPhone { get; init; }
    public required string LabelEmploymentDate { get; init; }
    public required string LabelPosition { get; init; }
    public required string LabelEmploymentType { get; init; }
    public required string LabelHoursPerWeek { get; init; }

    // Settings
    public required string LabelSettings { get; init; }
    public required string SettingShowInBooking { get; init; }
    public required string SettingShowInBookingDesc { get; init; }
    public required string SettingSmsReminders { get; init; }
    public required string SettingSmsRemindersDesc { get; init; }
    public required string SettingEditCalendar { get; init; }
    public required string SettingEditCalendarDesc { get; init; }
    public required string ToggleYes { get; init; }
    public required string ToggleNo { get; init; }

    // Notifications
    public required string LabelNotifications { get; init; }
    public required string NotificationsIntro { get; init; }
    public required string NotifOnlineBooking { get; init; }
    public required string NotifManualBooking { get; init; }
    public required string NotifCancellation { get; init; }
    public required string NotifWaitlist { get; init; }
    public required string NotifDailySummary { get; init; }
}
