// src/adapters/dealCardAdapter.ts
import type { DealCard } from "../../models/deal/DealCard"
import type { DealCardResponse } from "../../api/deal/types"

export function mapDealCardResponseToDeal(
  api: DealCardResponse
): DealCard{
  return {
    id: api.id,
    title: api.title,
    description: api.description,
    price: api.price ?? undefined,

    score: api.score,
    commentsCount:api.commentsCount,
    status: api.status,
    saleType: api.saleType,
    affiliateType: api.affiliateType,

    createdAt: api.createdAt,
    updatedAt:api.updatedAt,
    user: {
      id: api.user.id,
      username: api.user.username,
      avatarUrl: api.user.avatarUrl,
    },

    seller:{
      name:api.seller.name,
      url:api.seller.url
    },

    imageUrl:api.imageUrl,
  }
}
