<?php

namespace Opencart\Extension\Alsendo\DTO\ConfigurationRequests;

require_once(DIR_EXTENSION . 'alsendo/src/DTO/ConfigurationRequests/CoreConfigurationRequestDTO.php');

class SaveAdditionalSettingsRequestDTO
{
    public ?string $inpostDefaultPoint = null;
    public ?string $dhlDefaultPoint = null;
    public ?string $orlenDefaultPoint = null;
    public ?string $pocztaPolskaDefaultPoint = null;
    public ?string $dpdDefaultPoint = null;
    public ?string $upsDefaultPoint = null;
    public ?string $balikovnaDefaultPoint = null;
    public ?string $glsDefaultPoint = null;
    public ?string $pplDefaultPoint = null;
    public ?string $zasilkovnaDefaultPoint = null;
    public ?string $samedayDefaultPoint = null;
    public ?string $fanCourierDefaultPoint = null;
    public ?string $cargusDefaultPoint = null;
    public ?string $pickupHourFrom = null;
    public ?string $pickupHourTo = null;
    public bool $autoDeclaredValue = false;
    public bool $samedayDispatch = false;

    public static function fromCoreConfigurationRequestDTO(CoreConfigurationRequestDTO $coreDto): self
    {
        $dto = new self();
        $dto->inpostDefaultPoint = $coreDto->inpostDefaultPoint;
        $dto->dhlDefaultPoint = $coreDto->dhlDefaultPoint;
        $dto->orlenDefaultPoint = $coreDto->orlenDefaultPoint;
        $dto->pocztaPolskaDefaultPoint = $coreDto->pocztaPolskaDefaultPoint;
        $dto->dpdDefaultPoint = $coreDto->dpdDefaultPoint;
        $dto->upsDefaultPoint = $coreDto->upsDefaultPoint;
        $dto->balikovnaDefaultPoint = $coreDto->balikovnaDefaultPoint;
        $dto->glsDefaultPoint = $coreDto->glsDefaultPoint;
        $dto->pplDefaultPoint = $coreDto->pplDefaultPoint;
        $dto->zasilkovnaDefaultPoint = $coreDto->zasilkovnaDefaultPoint;
        $dto->samedayDefaultPoint = $coreDto->samedayDefaultPoint;
        $dto->fanCourierDefaultPoint = $coreDto->fanCourierDefaultPoint;
        $dto->cargusDefaultPoint = $coreDto->cargusDefaultPoint;
        $dto->pickupHourFrom = $coreDto->pickupHourFrom;
        $dto->pickupHourTo = $coreDto->pickupHourTo;
        $dto->autoDeclaredValue = $coreDto->autoDeclaredValue;
        $dto->samedayDispatch = $coreDto->samedayDispatch;

        return $dto;
    }

    public function toArray(): array
    {
        return [
            'inpost_default_point' => $this->inpostDefaultPoint,
            'dhl_default_point' => $this->dhlDefaultPoint,
            'orlen_default_point' => $this->orlenDefaultPoint,
            'poczta_polska_default_point' => $this->pocztaPolskaDefaultPoint,
            'dpd_default_point' => $this->dpdDefaultPoint,
            'ups_default_point' => $this->upsDefaultPoint,
            'balikovna_default_point' => $this->balikovnaDefaultPoint,
            'gls_default_point' => $this->glsDefaultPoint,
            'ppl_default_point' => $this->pplDefaultPoint,
            'zasilkovna_default_point' => $this->zasilkovnaDefaultPoint,
            'sameday_default_point' => $this->samedayDefaultPoint,
            'fan_courier_default_point' => $this->fanCourierDefaultPoint,
            'cargus_default_point' => $this->cargusDefaultPoint,
            'pickup_hour_from' => $this->pickupHourFrom,
            'pickup_hour_to' => $this->pickupHourTo,
            'auto_declared_value' => $this->autoDeclaredValue,
            'sameday_dispatch' => $this->samedayDispatch,
        ];
    }
}
