<app-configuration-form
  [form]="form"
  (cancel)="cancel.emit()"
  (triggerSubmit)="submit()">
  <ng-container [formGroup]="configForm">
    <div class="form-entry field-list">
      <div class="form-entry">
        <label for="askTo">{{ 'retrieval-agents.workflow.node-types.rephrase.form.ask-to.label' | translate }}</label>
        <pa-select
          id="askTo"
          formControlName="kb"
          externalLabel
          [placeholder]="'retrieval-agents.workflow.node-types.rephrase.form.ask-to.placeholder' | translate"
          [options]="sourceOptions()"></pa-select>
      </div>
      @if (sourceOptions()?.length === 0) {
        <nsi-info-card type="warning">
          {{ 'retrieval-agents.workflow.node-types.ask.form.no-source' | translate }}
        </nsi-info-card>
        <pa-button
          aspect="basic"
          size="small"
          [routerLink]="driversPath()">
          {{ 'retrieval-agents.workflow.node-types.ask.form.go-to-drivers' | translate }}
        </pa-button>
      }
    </div>

    <pa-toggle
      formControlName="extend"
      withBackground>
      {{ 'retrieval-agents.workflow.node-types.rephrase.form.extend' | translate }}
    </pa-toggle>

    <pa-toggle
      formControlName="synonyms"
      withBackground
      [help]="'retrieval-agents.workflow.node-types.rephrase.form.synonyms.help' | translate">
      {{ 'retrieval-agents.workflow.node-types.rephrase.form.synonyms.label' | translate }}
    </pa-toggle>
    @if (configForm.value.synonyms) {
      <app-synonyms-field
        formControlName="provided_synonyms"
        [label]="'Provided synonyms'"></app-synonyms-field>
    }
    <pa-toggle
      formControlName="history"
      withBackground
      [help]="'retrieval-agents.workflow.node-types.rephrase.form.history.help' | translate">
      {{ 'retrieval-agents.workflow.node-types.rephrase.form.history.label' | translate }}
    </pa-toggle>
    <pa-toggle
      formControlName="userInfo"
      withBackground
      [help]="'retrieval-agents.workflow.node-types.rephrase.form.user-info.help' | translate">
      {{ 'retrieval-agents.workflow.node-types.rephrase.form.user-info.label' | translate }}
    </pa-toggle>
    <pa-toggle
      formControlName="split_question"
      withBackground
      [help]="'retrieval-agents.workflow.node-types.rephrase.form.split-question.help' | translate">
      {{ 'retrieval-agents.workflow.node-types.rephrase.form.split-question.label' | translate }}
    </pa-toggle>
    <app-model-select
      [label]="'retrieval-agents.workflow.common-forms.model' | translate"
      [form]="configForm"
      controlName="model"></app-model-select>
    <app-rules-field
      [form]="configForm"
      [config]="config"></app-rules-field>
  </ng-container>
</app-configuration-form>
