import {Component, OnInit} from '@angular/core';
import {FrameDetailComponent} from "../../core/detail/frame.detail";
import {BsModalRef} from "ngx-bootstrap/modal";
import {FormBuilder, Validators} from "@angular/forms";
import {datetimeValidator} from "../../../../shared/validators/datetime.validator";

@Component({
  selector: 'app-frame-timer-detail',
  templateUrl: './frame-timer-detail.component.html',
  styleUrls: ['./frame-timer-detail.component.scss']
})
export class FrameTimerDetailComponent extends FrameDetailComponent implements OnInit {

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
    this.detailForm = fb.group({
      'timer_name': [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(128)])],
      'timer_cron': [null],
      'timer_class': [null, Validators.compose([Validators.required, Validators.minLength(2), Validators.maxLength(128)])],
      'timer_param': [null],
      'project_name': [null],
      'timer_order': [null, Validators.compose([Validators.required])],
      'timer_start_time': [null, Validators.compose([Validators.required, datetimeValidator])],
      'timer_end_time': [null, Validators.compose([Validators.required, datetimeValidator])],
      'auto_run_flag': [null, Validators.compose([Validators.required])],
      'timer_status': [null, Validators.compose([Validators.required])],
      'single_run_flag': [null, Validators.compose([Validators.required])],
      'reload_param_flag': [null, Validators.compose([Validators.required])],
      'log_flag': [null, Validators.compose([Validators.required])],
      'timer_desc': [null]

    });
  }

  ngOnInit() {
  }


}

