/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package controller.commands;

import controller.CommandInterface;
import gui.Hauptfenster;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sip.SipException;
import logger.OhmLogger;
import model.SIPmodel;

/**
 *
 * @author Jan
 * Fehlende Ergänzungen(timer nach 10 sec für abbruchbedingung + bedingung falls angenommen wurde -> Boolean)
 */
public class CommandInvite implements CommandInterface
{ 
  private static final Logger lginvite = OhmLogger.getLogger(); 
  private SIPmodel model;
  private Hauptfenster view;
  public CommandInvite(SIPmodel model, Hauptfenster view)
  {
    this.model = model;
    this.view = view;         
  }
  
  @Override
  public void execute() 
  {
    try
    { 
      view.getTxtArea().append("Einladung an " +  view.getTxtcallIP().getText() + " gesendet\n");
      model.sendInvitation(view.getTxtcallIP().getText(),view.getTxtServerIP().getText(), 5078);
    }
    catch (SipException ex)
    {
      view.getTxtArea().append("Einladung fehlgeschlagen\n");
      lginvite.getLogger(CommandInvite.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  @Override
  public void undo()
  {
    
  }

  @Override
  public Boolean isundoable()
  {
    return false;
  }
}
