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

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

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


            gridItems.DataSource = itemList;
        }

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

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