<div class="ai-models page-spacing">
  <header>
    <div class="page-title">{{ 'kb.ai-models.page-title' | translate }}</div>
    <p class="page-description">{{ 'kb.ai-models.page-description' | translate }}</p>
  </header>

  @if (noKbConfig) {
    <nsi-info-card
      type="warning"
      icon="warning">
      {{ 'kb.ai-models.error.kb-not-supported' | translate }}
    </nsi-info-card>
  } @else {
    <pa-tabs notFullWidth>
      <pa-tab
        (click)="selectTab('answer-generation')"
        [active]="selectedTab === 'answer-generation'">
        {{ 'kb.ai-models.tabs.answer-generation' | translate }}
      </pa-tab>
      <pa-tab
        [stfUnauthorizedFeature]="(isSummarizationAuthorized | async) === false"
        (click)="selectTab('summarization')"
        [active]="selectedTab === 'summarization'">
        {{ 'kb.ai-models.tabs.summarization' | translate }}
      </pa-tab>
      <pa-tab
        [stfUnauthorizedFeature]="!standalone && (isVectorsetAuthorized | async) === false"
        (click)="selectTab('semantic-model')"
        [active]="selectedTab === 'semantic-model'">
        {{ 'kb.ai-models.tabs.semantic-model' | translate }}
      </pa-tab>
      @if ((extractConfigEnabled | async) && !standalone) {
        <pa-tab
          (click)="selectTab('extraction')"
          [active]="selectedTab === 'extraction'">
          {{ 'kb.ai-models.tabs.extraction' | translate }}
        </pa-tab>
      }
      <pa-tab
        (click)="selectTab('anonymization')"
        [active]="selectedTab === 'anonymization'">
        {{ 'kb.ai-models.tabs.anonymization' | translate }}
      </pa-tab>
    </pa-tabs>

    @switch (selectedTab) {
      @case ('answer-generation') {
        <stf-answer-generation
          [kb]="kb"
          [learningConfigurations]="learningConfigurations"
          [kbConfigBackup]="kbConfigBackup"
          [providers]="providers"></stf-answer-generation>
      }
      @case ('summarization') {
        <stf-summarization
          [kb]="kb"
          [learningConfigurations]="learningConfigurations"
          [kbConfigBackup]="kbConfigBackup"
          [providers]="providers"></stf-summarization>
      }
      @case ('semantic-model') {
        <stf-semantic-model
          [kb]="kb"
          [learningConfigurations]="learningConfigurations"
          [kbConfigBackup]="kbConfigBackup"></stf-semantic-model>
      }
      @case ('extraction') {
        <stf-extraction
          [learningConfigurations]="learningConfigurations"
          [providers]="providers"></stf-extraction>
      }
      @case ('anonymization') {
        <stf-anonymization
          [kb]="kb"
          [learningConfigurations]="learningConfigurations"
          [kbConfigBackup]="kbConfigBackup"></stf-anonymization>
      }
    }
  }
</div>
