package com.app.simplitend.patientprofile.medreminder.mvvm;

import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel;

import com.app.simplitend.patientprofile.ProfileContracts;
import com.app.simplitend.patientprofile.medreminder.mvvm.models.ReminderResult;

public class ReminderViewModel extends ViewModel {

    private final ReminderRepository reminderRepository;

    // selected day of week
    public int selected_dow;

    public ReminderViewModel(){

        // selection state default
        selected_dow = 0;

        reminderRepository = ReminderRepository.getReminderRepository();
    }

    public void getRemindersList(int patient_id, int day_of_week, String token,
                                 @NonNull ProfileContracts.GetRemindersListCallback remindersListCallback) {
        reminderRepository.getRemindersList(patient_id, day_of_week, token, remindersListCallback);
    }

    public void addReminder(int patient_id, ReminderResult body, String token,
                            @NonNull ProfileContracts.AddReminderCallBack addReminderCallBack){
        reminderRepository.addReminder(patient_id, body, token, addReminderCallBack);
    }

    public void fetchFreqNMedTypes(String token,
                                   @NonNull ProfileContracts.FreqNMedTypesCallback freqNMedTypesCallback){
        reminderRepository.fetchFreqNMedTypes(token, freqNMedTypesCallback);
    }

    public void deleteReminder(int patient_id,
                               int patient_reminder_id,
                               int adapterPos,
                               String token,
                               @NonNull ProfileContracts.ReminderDeleteCallback deleteCallback){
        reminderRepository.deleteReminder(patient_id, patient_reminder_id, adapterPos, token, deleteCallback);
    }

    public String getDayOfWeek(int position){
        switch (position){
            case 0:
                return "Sun";
            case 1:
                return "Mon";
            case 2:
                return "Tue";
            case 3:
                return "Wed";
            case 4:
                return "Thu";
            case 5:
                return "Fri";
            case 6:
                return "Sat";
        }

        return "";
    }

    public String getMonthOfYear(int month){
        switch (month){
            case 1:
                return "January";
            case 2:
                return "February";
            case 3:
                return "March";
            case 4:
                return "April";
            case 5:
                return "May";
            case 6:
                return "June";
            case 7:
                return "July";
            case 8:
                return "August";
            case 9:
                return "September";
            case 10:
                return "October";
            case 11:
                return "November";
            case 12:
                return "December";
        }

        return "";
    }



}
