<?php

namespace App\NotificationMaps;

/**
 * The result of mapping an inbound notification payload through a NotificationMap.
 *
 * Mirrors the shape the existing vehicle imports produce: a column => value bag
 * suitable for Vehicle::fill(), a separate custom-attribute bag (attribute.<slug>),
 * and a flat list of image URLs ready for the image sync step. Taxonomy names,
 * the dealership reference, and the equipment / technical-data lists are resolved
 * and synced later by NotificationMapVehicleUpsert (which has the saved vehicle).
 *
 * equipment / technicalData are null when the payload did not include the key, so a
 * partial payload never wipes those relations; an explicit (even empty) list replaces.
 */
class MappedPayload
{
    /**
     * @param array<string, mixed> $attributes Vehicle column => value
     * @param array<string, mixed> $customAttributes Custom attribute slug => value
     * @param array<int, string> $images Image URLs
     * @param array<string, array{destination: string, value: string}> $taxonomies Keyed by taxonomy (make, model, ...)
     * @param string|null $dealership Dealership name or stock location to resolve
     * @param array<int, array<string, mixed>>|null $equipment Equipment entries (null = not provided)
     * @param array<int, array<string, mixed>>|null $technicalData Technical-data entries (null = not provided)
     */
    public function __construct(
        public array $attributes = [],
        public array $customAttributes = [],
        public array $images = [],
        public array $taxonomies = [],
        public ?string $dealership = null,
        public ?array $equipment = null,
        public ?array $technicalData = null,
    ) {
    }
}
