/**
 * LanguagesTab Component
 * Displays Umbraco languages from umbracoLanguage
 */
Vue.component('languages-tab', {
    props: {
        languages: {
            type: Array,
            default: () => []
        }
    },
    template: `
        <div class="languages-tab fade-up">
            <div class="section-card">
                <div class="section-card-header">
                    <h6><i class="bi bi-translate me-2" style="color:var(--cyan)"></i>Languages</h6>
                </div>
                <div class="section-card-body" style="max-height: 500px;">
                    <table class="table-dark-custom">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>ISO Code</th>
                                <th>Culture Name</th>
                                <th>Default</th>
                                <th>Mandatory</th>
                                <th>Fallback</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="lang in languages" :key="lang.id">
                                <td class="mono">{{ lang.id }}</td>
                                <td class="mono">{{ lang.languageISOCode }}</td>
                                <td style="color:var(--text-primary); font-weight: 500;">{{ lang.languageCultureName }}</td>
                                <td><span v-if="lang.isDefaultVariantLang" class="chip chip-cyan">Default</span><span v-else class="text-muted">—</span></td>
                                <td><span v-if="lang.mandatory" class="chip chip-warning">Yes</span><span v-else class="text-muted">—</span></td>
                                <td class="mono">{{ lang.fallbackLanguageId != null ? lang.fallbackLanguageId : '—' }}</td>
                            </tr>
                            <tr v-if="languages.length === 0">
                                <td colspan="6" style="text-align: center; color: var(--text-muted); padding: 2rem;">No languages detected</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    `
});
