<?php

namespace Alsendo\AlsendoWrapper\Api\Apaczka\Model\Order\Created;

use Alsendo\AlsendoWrapper\Json;
use Alsendo\AlsendoWrapper\Model\Order\Created\OrderCreatedResponse;
use Alsendo\AlsendoWrapper\Model\Order\Created\Receiver;
use Alsendo\AlsendoWrapper\Model\Shipment;

class ApaczkaOrderCreatedResponse extends OrderCreatedResponse
{
    public static function getPropertyTypeMap(): array
    {
        return [
            'id' => ['mappedTo' => 'id'],
            'service_id' => ['mappedTo' => 'service_id'],
            'service_name' => ['mappedTo' => 'service_name'],
            'waybill_number' => ['mappedTo' => 'waybill_number'],
            'pickup_number' => ['mappedTo' => 'pickup_number'],
            'tracking_url' => ['mappedTo' => 'tracking_url'],
            'status' => ['mappedTo' => 'status'],
            'shipments_count' => ['mappedTo' => 'shipments_count'],
            'receiver' => ['mappedTo' => 'receiver', 'type' => Receiver::class, 'mapFields' => [
                'name' => 'name',
                'contact_person' => 'contact_person',
                'email' => 'email',
                'phone' => 'phone',
                'line1' => 'line1',
                'line2' => 'line2',
                'postal_code' => 'postal_code',
                'city' => 'city',
                'country_code' => 'country_code',
                'foreign_address_id' => 'foreign_address_id',
            ]
            ],
            'shipments' => ['mappedTo' => 'shipments', 'type' => Shipment::class, 'mapFields' => [
                'weight' => 'weight',
                'dimension.length' => 'dimension1',
                'dimension.width' => 'dimension2',
                'dimension.height' => 'dimension3',
                'declared_value' => 'declarationValue',
                'content' => 'content',
            ]],

            'created' => ['mappedTo' => 'created', 'convert' => Json::DATE_TIME],
        ];
    }
}