<?php

namespace Fifa\ConnectId\Sdk\Util\MessageSerializers;

use Fifa\ConnectId\Sdk\Model\Transfer\ProofOfPayment;
use Fifa\ConnectId\Sdk\Util\Serialization\Configurations\CommonXmlSerializerConfiguration;
use Fifa\ConnectId\Sdk\Util\Serialization\Configurations\ProofOfPaymentXmlSerializerConfiguration;
use Fifa\ConnectId\Sdk\Util\Serialization\ValidatingXmlSerializerBase;
use Fifa\ConnectId\Sdk\Util\XmlDeserializer\XmlDeserializer;
use XML_Serializer;

class ProofOfPaymentXmlSerializer extends ValidatingXmlSerializerBase
{
    public function __construct()
    {
        $xmlDeserializer = new XmlDeserializer(ProofOfPayment::class, ProofOfPaymentXmlSerializerConfiguration::getMappings());

        $xmlSerializer = new XML_Serializer();
        $xmlSerializer->setOptions(CommonXmlSerializerConfiguration::buildOptions('ProofOfPayment',
            [
                XML_SERIALIZER_OPTION_SCALAR_AS_ATTRIBUTES => ProofOfPaymentXmlSerializerConfiguration::getScalarAsAttributes(),
                XML_SERIALIZER_OPTION_TAGMAP => ProofOfPaymentXmlSerializerConfiguration::getTagmap()
            ]
        ));

        parent::__construct($xmlSerializer, $xmlDeserializer);
    }
}