<?php

namespace Alsendo\AlsendoWrapper\Api\Ecolet\Model\Order;

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

class EcoletOrderSendResponse extends OrderCreatedResponse
{
    public static function getPropertyTypeMap(): array
    {
        return [
            'order_id' => ['mappedTo' => 'id'],
            'status' => ['mappedTo' => 'status'],
            'order.service_id' => ['mappedTo' => 'service_id'],
            'order.data.receiver' => ['mappedTo' => 'receiver', 'type' => Receiver::class, 'mapFields' => [
                'name' => ['mappedTo' => 'name'],
                'contact_person' => ['mappedTo' => 'contact_person'],
                'phone' => ['mappedTo' => 'phone'],
                'email' => ['mappedTo' => 'email'],
                'street_name' => ['mappedTo' => 'line1'],
                'street_number' => ['mappedTo' => 'line2'],
                'locality' => ['mappedTo' => 'city'],
                'has_map_point' => ['mappedTo' => 'has_map_point', 'convert' => Json::BOOLEAN],
                'map_point_id' => ['mappedTo' => 'map_point_id', 'convert' => Json::INTEGER],
                'country' => ['mappedTo' => 'country_code'],
            ]],
            'order.data.courier.service' => ['mappedTo' => 'service_name'],
            'order.data.parcels' => ['mappedTo' => 'shipments', 'type' => Shipment::class, 'mapFields' => [
                'weight' => ['mappedTo' => 'weight'],
                'dimensions.length' => ['mappedTo' => 'dimension1'],
                'dimensions.width' => ['mappedTo' => 'dimension2'],
                'dimensions.height' => ['mappedTo' => 'dimension3'],
                'declared_value' => ['mappedTo' => 'declaredValue'],
                'content' => ['mappedTo' => 'content']
            ]],

        ];
    }
}