using System.Collections.Generic;
using System.Windows.Forms;
using SepehrFlightApiSampleClient.Availability.WinForms.DateRange.ViewModels;
using SepehrFlightApiSampleClient.BuiltinTypeExtensions;

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

        public void SetFare(
            Fare onewayFare,
            Fare roundtripFareSameOrigin,
            Fare roundtripFareOppositeOrigin)
        {
            var itemList = new List<Item>()
            {
                new Item
                {
                    Desc = nameof(Fare.BaseFare),
                    Amount = onewayFare.BaseFare.FormattedNumber(),
                },
                new Item
                {
                    Desc = nameof(Fare.Tax),
                    Amount = onewayFare.Tax.FormattedNumber(),
                },
                new Item
                {
                    Desc = nameof(Fare.TotalFare),
                    Amount = onewayFare.TotalFare.FormattedNumber(),
                },
                new Item
                {
                    Desc = nameof(Fare.Commision),
                    Amount = onewayFare.Commision.FormattedNumber(),
                },
                new Item
                {
                    Desc = nameof(Fare.Payable),
                    Amount = onewayFare.Payable.FormattedNumber(),
                },
            };


            gridItems.DataSource = itemList;
        }

        private class Item
        {
            public string Desc { get; set; }

            public string Amount { get; set; }
        }
    }
}
