<nus-user-container>
  <div class="onboarding-container">
    @if (onboardingStep | async; as step) {
      <header>
        @if (step < lastStep) {
          <h1>{{ 'onboarding.step' + step + (step === 3 && inRaoApp ? '.rao-' : '.') + 'title' | translate }}</h1>
          <p
            class="page-description"
            [innerHTML]="
              'onboarding.step' + step + (step === 3 && inRaoApp ? '.rao-' : '.') + 'subtitle' | translate
            "></p>
        } @else {
          <h1>{{ 'onboarding.setting-up.title' | translate }}</h1>
          <p class="page-description">{{ 'onboarding.setting-up.subtitle' | translate }}</p>
        }
      </header>

      @switch (step) {
        @case (1) {
          @if (!creatingAccount) {
            <nus-onboarding-step1
              [data]="onboardingInquiryPayload"
              (submitStep1)="createAccountAndInquiry($event)"></nus-onboarding-step1>
          } @else {
            <nus-onboarding-setting-up></nus-onboarding-setting-up>
          }
        }
        @case (2) {
          <nus-account-workflow (next)="storeWorkflowAndGoNext($event)"></nus-account-workflow>
        }
        @case (3) {
          <nus-kb-name-step
            [data]="kbName"
            (next)="storeKbNameAndGoNext($event)"></nus-kb-name-step>
        }
        @case (4) {
          <nus-zone-step
            [data]="zone"
            [cowork]="isCowork"
            (back)="goBack()"
            (next)="storeZoneAndGoNext($event)"></nus-zone-step>
        }
        @case (5) {
          <nus-embedding-model-step
            [schema]="learningSchema | async"
            [cowork]="isCowork"
            [isLastStep]="true"
            (back)="goBack()"
            (next)="storeLearningConfigAndGoNext($event)"></nus-embedding-model-step>
        }
        @case (6) {
          <nus-onboarding-setting-up></nus-onboarding-setting-up>
        }
      }
    }
    @if (showLogout) {
      <footer>
        <pa-button
          aspect="basic"
          (click)="logout()">
          {{ 'generic.logout' | translate }}
        </pa-button>
      </footer>
    }
  </div>
</nus-user-container>
