import { Component, Inject, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ConditionsData } from 'src/app/interfaces/acquisition-management/provider/provider.interface';

@Component({
  selector: 'app-info-condition-provider',
  templateUrl: './condition-provider-form.component.html',
  styleUrls: ['./condition-provider-form.component.css']
})
export class ConditionProviderFormComponent implements OnInit {

  public formGroup: FormGroup;

  constructor(
    @Inject(MAT_DIALOG_DATA) public conditions: ConditionsData
  ) {
    this.formGroup = this.createFromGroup();
  }

  ngOnInit(): void {
  }

  private createFromGroup(): FormGroup {
    return new FormGroup({
      TIPO_CONDICION: new FormControl(this.conditions.TIPO_CONDICION),
      INFORMACION: new FormControl(this.conditions.INFORMACION),
    });
  }

  get TIPO_CONDICION() { return this.formGroup.get('TIPO_CONDICION'); }
  get INFORMACION() { return this.formGroup.get('INFORMACION'); }

}
