using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

namespace UI.Employee
{
    public class WorkerDetails : MonoBehaviour
    {
        [SerializeField] private TextMeshProUGUI timeOnEventText;
        [SerializeField] private TextMeshProUGUI eventsPerWeekText;
        [SerializeField] private TextMeshProUGUI salaryText;

        public void Init(Employees.EmployeeData data)
        {
            salaryText.text = $"{data.salary}$";
            eventsPerWeekText.text = data.eventsPerWeek.ToString();
            timeOnEventText.text = ConvertTimeToText(data.maxTimeOnEvent);
        }

        private string ConvertTimeToText(int time)
        {
            string str = "";

            int hours = time / 60;
            int mins = time % 60;

            str = $"{hours.ToString("00")}h {mins.ToString("00")}m";

            return str;
        }
    }
}