/**
 * Copyright (C) 2022 - Florindo Smilari (spherIC)
 */
package ch.spherIC.recurvebowsight.ui.calcsight;

import android.text.TextUtils;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import ch.spherIC.recurvebowsight.model.IArcherySetup;

public class CalculateSightViewModel extends ViewModel {

    private final MutableLiveData<String> mText;

    private IArcherySetup selectedArcherySetup;

    public CalculateSightViewModel() {
        mText = new MutableLiveData<>();
        mText.setValue("This is the \"Calc Sight\" fragment for: \n-");
    }

    public IArcherySetup getSelectedArcherySetup() {
        return selectedArcherySetup;
    }

    public void setSelectedArcherySetup(IArcherySetup selectedArcherySetup) {
        this.selectedArcherySetup = selectedArcherySetup;
        String setupName = (this.selectedArcherySetup != null && !TextUtils.isEmpty(this.selectedArcherySetup.getName())) ? this.selectedArcherySetup.getName() : "-";
        mText.setValue("This is the \"Calc Sight\" fragment for: \n" + setupName);
    }


    public LiveData<String> getText() {
        return mText;
    }
}