<script setup>
import { getRegionFrequencyRange } from '../../utils.js';
const props = defineProps(['node']);
</script>

<template>
    <!-- lora config -->
    <div>
        <div class="bg-gray-200 p-2 font-semibold">LoRa Config</div>
        <ul role="list" class="flex-1 divide-y divide-gray-200">

            <!-- region -->
            <li class="flex p-3">
                <div class="text-sm font-medium text-gray-900">Region</div>
                <div class="ml-auto text-sm text-gray-700">
                    <span v-if="props.node.region_name">{{ props.node.region_name }} ({{ getRegionFrequencyRange(props.node.region_name) }})</span>
                    <span v-else>???</span>
                </div>
            </li>

            <!-- modem preset -->
            <li class="flex p-3">
                <div class="text-sm font-medium text-gray-900">Modem Preset</div>
                <div class="ml-auto text-sm text-gray-700">
                    <span v-if="props.node.modem_preset_name">{{ props.node.modem_preset_name }}</span>
                    <span v-else>???</span>
                </div>
            </li>

            <!-- has default channel -->
            <li class="flex p-3">
                <div class="text-sm font-medium text-gray-900">Has Default Channel</div>
                <div class="ml-auto text-sm text-gray-700">
                    <span v-if="props.node.has_default_channel != null">{{ props.node.has_default_channel ? "Yes" : "No" }}</span>
                    <span v-else>???</span>
                </div>
            </li>
        </ul>
    </div>
</template>