<?php

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

use Alsendo\AlsendoWrapper\Json;
use Alsendo\AlsendoWrapper\Model\Order\Valuation\OrderValuation;
use Alsendo\AlsendoWrapper\Model\Order\Valuation\PriceTableItem;

class EcoletOrderValuation extends OrderValuation
{
    //Only in Ecolet
    public ?array $additionalServices = null;
    public ?array $pickupDates = null;
    public ?bool $isStandard = null;
    public ?array $fees = null;
    public ?int $vat = null;
    public array $info = [];
    public array $errors = [];

    public static function getPropertyTypeMap(): array
    {
        return [
            'service_id' => ['mappedTo' => 'serviceId'],
            'pickup_dates' => ['mappedTo' => 'pickupDates'],
            'is_standard' => ['mappedTo' => 'isStandard', 'convert' => Json::BOOLEAN],
            'additional_services' => ['mappedTo' => 'additionalServices'],
            'price' => ['mappedTo' => 'priceTable', 'type' => PriceTableItem::class, 'mapFields' => [
                'net' => 'price',
                'gross' => 'priceGross',
            ]],
            'vat' => ['mappedTo' => 'vat', 'convert' => Json::INTEGER],
            'info' => ['mappedTo' => 'info'],
            'errors' => ['mappedTo' => 'errors'],
        ];
    }
}