<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-->

<nz-modal
  [(nzVisible)]="modalProps.isVisible"
  nzTitle="{{'Create Experiment' | translate}}"
  (nzOnCancel)="closeModal()"
  [nzWidth]="1000"
  [nzContent]="modalContent"
  [nzFooter]="modalFooter"
>
  <ng-template #modalContent>
    <nz-button-group id="form-type-container" *ngIf="!modalProps.formType">
      <button nz-button nzType="primary" id="customized" (click)="modalProps.formType = 'customized'">
        {{'Define your experiment' | translate}}
      </button>
      <button nz-button nzType="primary" id="pre" (click)="modalProps.formType = 'predefined'">
        {{'From predefined experiment library' | translate}}
      </button>
    </nz-button-group>
    <submarine-experiment-customized-form
      [mode]="mode"
      [targetId]="targetId"
      [targetSpec]="targetSpec"
      *ngIf="modalProps.formType === 'customized'"
    ></submarine-experiment-customized-form>
    <submarine-experiment-predefined-form
      *ngIf="modalProps.formType === 'predefined'"
    ></submarine-experiment-predefined-form>
  </ng-template>
  <ng-template #modalFooter>
    <button nz-button nzType="default" (click)="closeModal()">{{'Cancel' | translate}}</button>
    <button
      id="go"
      nz-button
      nzType="primary"
      *ngIf="modalProps.formType"
      [disabled]="nextBtnDisable"
      (click)="proceedForm()"
    >
      {{ modalProps.okText | translate }}
    </button>
    <button *ngIf="modalProps.currentStep > 0" nz-button nzType="default" style="float: left" (click)="prevForm()">
      {{'Prev Step' | translate}}
    </button>
  </ng-template>
</nz-modal>
