import { describe, expect, it } from 'vitest'
import { presentVehicleWithAvailability } from './carplace.presenter'

describe('carplace.presenter', () => {
  it('adds public availability fields without mutating the original vehicle shape', () => {
    const nextAvailableAt = new Date('2026-08-01T10:00:00.000Z')
    const vehicle = { id: 'vehicle_1', make: 'Dacia', model: 'Logan', dailyRate: 25000 }

    expect(presentVehicleWithAvailability(vehicle, {
      available: false,
      status: 'RESERVED',
      nextAvailableAt,
    })).toEqual({
      id: 'vehicle_1',
      make: 'Dacia',
      model: 'Logan',
      dailyRate: 25000,
      availability: false,
      availabilityStatus: 'RESERVED',
      nextAvailableAt,
    })

    expect(vehicle).toEqual({ id: 'vehicle_1', make: 'Dacia', model: 'Logan', dailyRate: 25000 })
  })
})
