// EN: Mapper for Inventory domain entities to DTOs.
// VI: Mapper từ domain entities sang DTOs.

using InventoryService.Domain.AggregatesModel.InventoryAggregate;
using InventoryService.API.Application.DTOs;

namespace InventoryService.API.Application.Mappers;

/// <summary>
/// EN: Mapper from domain entities to DTOs.
/// VI: Mapper từ domain entities sang DTOs.
/// </summary>
public static class InventoryMapper
{
    /// <summary>
    /// EN: Convert InventoryItem to DTO.
    /// VI: Chuyển InventoryItem sang DTO.
    /// </summary>
    public static InventoryItemDto ToDto(this InventoryItem item) => new(
        item.Id,
        item.ProductId,
        item.ShopId,
        item.Quantity,
        item.ReservedQuantity,
        item.AvailableQuantity,
        item.ReorderLevel,
        item.UpdatedAt);

    /// <summary>
    /// EN: Convert InventoryTransaction to DTO.
    /// VI: Chuyển InventoryTransaction sang DTO.
    /// </summary>
    public static InventoryTransactionDto ToDto(this InventoryTransaction transaction) => new(
        transaction.Id,
        transaction.InventoryItemId,
        transaction.Type.Name,
        transaction.Quantity,
        transaction.ReferenceId,
        transaction.Notes,
        transaction.CreatedAt);
}
