using System.Collections.Generic;
using ResponseModel = Sepehr.ApiGateway.Partners.Contracts.Hotel.Availability.V4.SearchByCityAndDateAndGuests.ResponseModel;

namespace SepehrHotelApiSampleClient.Availability.SearchByCityAndDateAndGuests.WinForms.ViewModels
{
    public class HotelOption
    {
        public int SepehrHotelGlobalId { get; set; }

        public string Name { get; set; }

        public List<RoomType> RoomTypeList { get; set; }

        public List<Amenity> AmenityList { get; set; }

        public decimal TotalGrossPrice { get; set; }

        public decimal TotalCommission { get; set; }

        public decimal TotalNetPrice { get; set; }

        public string CurrencyCode { get; set; }

        public HotelOption(
            ResponseModel.HotelOption hotelOption,
            string responseCurrencyCode)
        {
            SepehrHotelGlobalId = hotelOption.SepehrHotelGlobalId;
            Name = hotelOption.Name;
            RoomTypeList = hotelOption
                .RoomTypeList
                .ConvertAll(roomType => new RoomType
                {
                    SepehrGlobalId = roomType.SepehrGlobalId,
                    Name = roomType.Name,
                    BoardTypeCode = roomType.BoardTypeCode,
                    AdultCount = roomType.AdultCount,
                    ChildAgeList = roomType.ChildAgeList,
                    ExtrabedAssignedCount = roomType.ExtrabedAssignedCount,
                    Hotel = this,
                });
            AmenityList = hotelOption
                .AmenityList
                .ConvertAll(amenity => new Amenity
                {
                    SepehrGlobalId = amenity.SepehrGlobalId,
                    Name = amenity.Name,
                    Quantity = amenity.Quantity,
                });
            TotalGrossPrice = hotelOption.TotalGrossPrice;
            TotalCommission = hotelOption.TotalCommission;
            TotalNetPrice = hotelOption.TotalNetPrice;
            CurrencyCode = responseCurrencyCode;
        }
    }
}
