import { UntypedFormBuilder, Validators } from '@angular/forms';
import { ValidatorsHelper } from '@shared/ui-api/helpers/validators-helper';

export class MonitorFormHelper {
  constructor(private formBuilder: UntypedFormBuilder) { }

  getMonitorForm() {
    return this.formBuilder.group({
      name: ['',],
      type: ['', Validators.required],
      max_retries_down: [3, [ValidatorsHelper.requiredNumericValueValidator, Validators.min(1)]],
      delay: [5, [ValidatorsHelper.requiredNumericValueValidator, Validators.min(0)]],
      max_retries: [3, [ValidatorsHelper.requiredNumericValueValidator, Validators.min(1)]],
      timeout: [5, [ValidatorsHelper.requiredNumericValueValidator, Validators.min(0)]],
      http_method: ['GET'],
      expected_codes: ['200'],
      url_path: ['/'],
      admin_state_up: [true],
    });
  }
}
