import { Component, Inject, OnInit } from '@angular/core';
import {
  FormControl,
  FormGroup,
  Validators,
  FormsModule,
} from '@angular/forms';
import {
  MatDialog,
  MatDialogRef,
  MAT_DIALOG_DATA,
} from '@angular/material/dialog';
import { CheckBoxSelectionService } from '@syncfusion/ej2-angular-dropdowns';
import { MatSnackBar } from '@angular/material/snack-bar';
import { WorkflowService } from '../../../services/samwf/workflow.service';
import { TasksInterface } from '../../../interfaces/samwf/tasks-interface';
import { ActivatedRoute } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';

@Component({
  selector: 'app-request-workflow-form',
  templateUrl: './request-workflow-form.component.html',
  styleUrls: ['./request-workflow-form.component.css'],
})
export class RequestWorkflowFormComponent implements OnInit {
  formGroup: FormGroup;

  constructor(
    public dialog: MatDialog,
    public dialogRef: MatDialogRef<any>,
    private _snackBar: MatSnackBar,
    private _samwfService: WorkflowService,
    private activatedRoute: ActivatedRoute,
    @Inject(MAT_DIALOG_DATA) public data: any,
    private translate: TranslateService
  ) {
    this.formGroup = this.createFormGroup();
  }

  private createFormGroup() {
    if (this.data.action == 'Aceptar') {
      return new FormGroup({
        reasons: new FormControl(''),
        isValidated: new FormControl(true),
      });
    } else {
      return new FormGroup({
        reasons: new FormControl(''),
        isValidated: new FormControl(false),
      });
    }
  }

  ngOnInit(): void {}

  get reasons() {
    return this.formGroup.get('reasons');
  }
}
