using Lada.Framework.Data.Domains.Finance;
using Lada.Framework.Data.Domains.Trucks;
using Ladaer.BackEnd.Infrastructures.DTO.Items.FuelCards;

namespace Ladaer.BackEnd.Infrastructures.DTO.Profiles
{
    /// <summary>
    /// Extension methods để map giữa FuelCard entities và items
    /// </summary>
    public static class FuelCardMappingProfile
    {
        /// <summary>
        /// Chuyển đổi FuelCardTransaction entity sang FuelCardTransactionItem
        /// </summary>
        public static FuelCardTransactionItem ToItem(this FuelCardTransaction entity)
        {
            return new FuelCardTransactionItem
            {
                Id = entity.Id,
                FuelCardId = entity.FuelCardId,
                CardNumber = entity.FuelCard?.CardNumber ?? string.Empty,
                TransactionDate = entity.TransactionDate,
                Amount = entity.Amount,
                RawAmount = entity.RawAmount,
                Currency = entity.Currency,
                TransactionType = entity.TransactionType,
                Location = entity.Location,
                Status = entity.Status,
                FuelRefillId = entity.FuelRefillId,
                IsReconciled = entity.IsReconciled,
                IsPaidToBank = entity.IsPaidToBank,
                PaidToBank = entity.PaidToBank,
                ProcessNote = entity.ProcessNote,
                CreatedTime = entity.CreatedTime,
                HasRefill = entity.FuelRefillId.HasValue && entity.FuelRefillId.Value > 0
            };
        }
    }
}
