<script setup lang="ts">
import ToggleSwitch from 'primevue/toggleswitch';
import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { useClientStore } from '../../stores';
import { useI18n } from 'vue-i18n';

const { t } = useI18n();

const client = useClientStore();
</script>

<template>
    <OptionCategory title="STARTLINER">
        <OptionRow
            :title="t('cfg.startliner.offlineMode')"
            :tooltip="`${t('cfg.startliner.offlineModeTooltip')} ${t('cfg.afterRestart')}`"
        >
            <ToggleSwitch
                :model-value="client.offlineMode"
                @update:model-value="
                    async (v) => await client.setOfflineMode(v)
                "
            />
        </OptionRow>
        <OptionRow :title="t('cfg.startliner.autoUpdate')">
            <ToggleSwitch
                :model-value="client.enableAutoupdates"
                @update:model-value="
                    async (v) => await client.setAutoupdates(v)
                "
            ></ToggleSwitch>
        </OptionRow>
        <OptionRow
            :title="t('cfg.startliner.verbose')"
            :tooltip="t('cfg.afterRestart')"
        >
            <ToggleSwitch
                :model-value="client.verbose"
                @update:model-value="async (v) => await client.setVerbose(v)"
            />
        </OptionRow>
    </OptionCategory>
</template>
