{#if state === 'checking'} {:else if state === 'complete' && result?.all_present} {:else if state === 'complete' && !result?.table_exists} {:else if state === 'complete' && !result?.all_present} {:else} {/if} {_('translate.target_schema.title') || 'Target Schema'}
{#if state === 'idle'}

{#if !targetTable} {_('translate.target_schema.enter_table') || 'Enter a target table name and click "Check Target Schema".'} {:else if !targetDatabaseId} {_('translate.target_schema.select_database') || 'Select a target database and click "Check Target Schema".'} {:else} {_('translate.target_schema.press_button') || 'Click "Check Target Schema" to verify the target table columns.'} {/if}

{:else if state === 'checking'}

{_('translate.target_schema.checking') || 'Checking target table schema…'}

{:else if state === 'complete' && result} {#key renderKey} {#if !result.table_exists}

{_('translate.target_schema.table_not_found') || 'Target table not found in the database.'}

{:else if result.all_present}

{_('translate.target_schema.all_present') || 'Target table has all required columns.'}

{:else}

{_('translate.target_schema.missing_columns_title') || 'Target table is missing some required columns.'}

{/if} {#if actualColumns.length > 0}

{_('translate.target_schema.expected_columns') || 'Required columns for translation inserts:'}

{#each actualColumns as col} {#if col.is_missing} {:else} {/if} {col.name} {#if col.data_type}({col.data_type}){/if} {/each}
{/if} {/key} {#if result.table_exists && !result.all_present}

{_('translate.target_schema.add_columns') || 'Add these missing columns to the target table, or configure custom column names in "Target Column Mapping" above.'}

{/if} {#if result.error}

{result.error}

{/if} {:else if state === 'error'}

{_('translate.target_schema.check_error') || 'Could not verify target table schema. Make sure the table exists and is accessible.'}

{/if}