using System;
using System.Collections.Generic;
using System.Windows.Forms;
using SepehrFlightApiSampleClient.ChangePassengerInfo.WebApi;
using RequestModel = Sepehr.ApiGateway.Partners.Contracts.Flight.ChangePassengerInfo.V1.DoChange.RequestModel;


namespace SepehrFlightApiSampleClient.ChangePassengerInfo.WinForms
{
    public partial class DoChangeForm : Form
    {
        private readonly MainForm _mainForm;
        private readonly RequestModel.Request _request;

        public DoChangeForm(
            MainForm mainForm,
            RequestModel.Request request)
        {
            _mainForm = mainForm;
            _request = request;
            InitializeComponent();

            lblSumOfPenalyAmountThatPassengerShouldPay.Text = request
                .TotalPenalty
                .ToString("N2");
        }

        private void btnDoChange_Click(object sender, EventArgs e)
        {
            DoChangeApi.Post(_mainForm.txtUrl.Text, _request);

            MessageBox.Show("Done :)");
        }
    }
}
