using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Administration
{
    public partial class ShipForm : Form
    {
        private ComplexFortress viewedShip;

        public ShipForm()
        {
            InitializeComponent();
        }

        public void SetState(ShipInformationAnswer answer)
        {
            this.viewedShip = new ComplexFortress(answer.fortress_id, answer.fortress_name, answer.coordinate_x, answer.coordinate_y);

            idBox.Text = viewedShip.ID.ToString();
            nameBox.Text = viewedShip.Name;
            positionXBox.Text = viewedShip.X.ToString();
            positionYBox.Text = viewedShip.Y.ToString();
        }

        private void deleteShipItem_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Vybraná loď bude odstraněna. Chcete opravdu odstranit loď?", "Žádost o potvrzení akce", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                DeleteShipRequest request = new DeleteShipRequest(viewedShip.ID);
                //Logic.Communicator.SendMessage(request);
            }
        }

        private void deleteItemButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Vybraný předmět bude odstraněn. Chcete opravdu odstranit předmět?", "Žádost o potvrzení akce", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                DeleteItemRequest request = new DeleteItemRequest(viewedShip.ID, ItemOrigins.SHIP);
                //Logic.Communicator.SendMessage(request);
            }
        }
    }
}
