using System.Windows.Forms;
using SepehrFlightApiSampleClient.Availability.WinForms.SearchByRouteAndDate;
using SepehrFlightApiSampleClient.Availability.WinForms.SearchByRouteAndDate.ViewModels;

namespace SepehrFlightApiSampleClient.Availability.WinForms.SearchByRouteAndDate
{
    public partial class FlightClassExtraInfoUserControl : UserControl
    {
        public FlightClassExtraInfoUserControl()
        {
            InitializeComponent();
        }

        public void SetFlightClass(FlightClass flightClassViewModel)
        {
            //adult
            var adultUserControl = new FareUserControl();
            adultUserControl.Location = new System.Drawing.Point(6, 6);
            adultUserControl.Dock = DockStyle.Fill;

            adultUserControl.SetFare(flightClassViewModel.Adult_Fare);

            tbgAdult.Controls.Clear();
            tbgAdult.Controls.Add(adultUserControl);

            //child
            var childUserControl = new FareUserControl();
            childUserControl.Location = new System.Drawing.Point(6, 6);
            childUserControl.Dock = DockStyle.Fill;

            childUserControl.SetFare(flightClassViewModel.Child_Fare);

            tbgChild.Controls.Clear();
            tbgChild.Controls.Add(childUserControl);

            //infant
            var infantUserControl = new FareUserControl();
            infantUserControl.Location = new System.Drawing.Point(6, 6);
            infantUserControl.Dock = DockStyle.Fill;

            infantUserControl.SetFare(flightClassViewModel.Infant_Fare);

            tbgInfant.Controls.Clear();
            tbgInfant.Controls.Add(infantUserControl);

            txtCancelationPolicy.Text = flightClassViewModel.CancelationPolicy;
        }
    }
}
