using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TIAM.Entities.Transfers;

namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
{
    public static class TransferWizardModelExtensions
    {
        public static TransferWizardModel Clone(this TransferWizardModel obj)
        {
            return new TransferWizardModel()
            {
                Id = Guid.NewGuid(),
                UserId = obj.UserId,
                ProductId = obj.ProductId,
                UserProductMappingId = obj.UserProductMappingId,
                UserProductToCarId = obj.UserProductToCarId,
                ReferralId = obj.ReferralId,
                Comment = obj.Comment,
                Destination = obj.Destination,
                PickupAddress = obj.PickupAddress,
                TripDate = obj.TripDate,
                NumberOfPassengers = obj.NumberOfPassengers,
                FullName = obj.FullName,
                PhoneNumber = obj.PhoneNumber,
                EmailAddress = obj.EmailAddress,
                Price = obj.Price,
                Driver = obj.Driver,
            };
        }

        public static Transfer CopyToTransfer(this TransferWizardModel obj)
        {
            var transfer = new Transfer
            {
                Id = obj.Id,
                UserId = obj.UserId,
                ProductId = obj.ProductId,
                ToAddress = obj.Destination,
                FromAddress = obj.PickupAddress,
                Appointment = obj.TripDate,
                PassengerCount = Convert.ToByte(obj.NumberOfPassengers),
                //FullName = model.FullName,
                //PhoneNumber = model.PhoneNumber,
                //EmailAddress = model.EmailAddress,
                Price = obj.Price,
                //UserProductMappingId = Guid.NewGuid(),
                TransferStatusType = TIAM.Core.Enums.TransferStatusType.OrderSubmitted,
                Comment = "Transfer order",

            };

            return transfer;
        }
    }
}
