import { Component, Inject, OnInit } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
    selector: 'app-change-pre-code-status',
    templateUrl: './change-pre-code-status.component.html',
    styleUrl: './change-pre-code-status.component.css',
    standalone: false
})
export class ChangePreCodeStatusComponent implements OnInit {
  action: string;
  code: string;
  commentsControl: FormControl;
  
  constructor(
    @Inject(MAT_DIALOG_DATA) private _data: any
  ) {
    this.action = "";
    this.code = "";
    this.commentsControl = new FormControl('', [Validators.required, Validators.minLength(15)]);
  }

  ngOnInit(): void {
    this.action = this._data.status == 'accept' ? 'Aceptar' : 'Rechazar';
    this.code = this._data.preCode;
  }
}
