package danielcortes.xyz.views.dialogs;

import java.awt.Desktop;
import java.io.IOException;
import java.nio.file.Path;
import javax.swing.JOptionPane;

public class InformeGeneratedConfirmation {

  private Path path;

  public InformeGeneratedConfirmation(Path path) {
    this.path = path;
  }

  public void execute() {
    int result = JOptionPane.showConfirmDialog(
        null,
        "El informes se a generado" + "\n" + "¿Desea abrirlo?",
        "Confirmacion",
        JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE
    );

    if (result == 0) {
      try {
        Desktop.getDesktop().open(this.path.toFile());
      } catch (IOException e) {
        e.printStackTrace();
      }

    }
  }
}
