<?php

namespace Fifa\ConnectId\Sdk\Util\Serialization\Configurations;

use Fifa\ConnectId\Sdk\Model\DataStandard\PersonLocal;
use Fifa\ConnectId\Sdk\Model\Transfer\Club;
use Fifa\ConnectId\Sdk\Model\Transfer\ConditionalTransferFee;
use Fifa\ConnectId\Sdk\Model\Transfer\DocumentEmbedded;
use Fifa\ConnectId\Sdk\Model\Transfer\EmploymentContract;
use Fifa\ConnectId\Sdk\Model\Transfer\FixedTransferFee;
use Fifa\ConnectId\Sdk\Model\Transfer\ReleaseBuyoutFee;
use Fifa\ConnectId\Sdk\Model\Transfer\ResidencePermit;
use Fifa\ConnectId\Sdk\Model\Transfer\TransferFeeDetails;
use Fifa\ConnectId\Sdk\Model\Transfer\WorkPermit;

class DomesticTransferDeclarationXmlSerializerConfiguration
{
    public static function getScalarAsAttributes(string $rootTag = 'DomesticTransferDeclaration'): array
    {
        return array_merge(
            PersonLocalXmlSerializerConfiguration::getScalarAsAttributes(),
            [
                $rootTag => ['MessageId', 'SellOnFee', 'PlayerLevelInReleasingClub', 'PlayerLevelInEngagingClub', 'TransferNature', 'TransferAgreementDate', 'EngagingTmsTransferId', 'ReleasingTmsTransferId', 'ContractEndDate'],
                'EmploymentContract' => CommonXmlSerializerConfiguration::getEmploymentContractScalarAsAttributes(),
                'WorkPermit' => CommonXmlSerializerConfiguration::getWorkPermitScalarAsAttributes(),
                'ResidencePermit' => CommonXmlSerializerConfiguration::getResidencePermitScalarAsAttributes(),
                'EngagingClub' => CommonXmlSerializerConfiguration::getClubScalarAsAttributes(),
                'ReleasingClub' => CommonXmlSerializerConfiguration::getClubScalarAsAttributes(),
                'ConditionalTransferFee' => CommonXmlSerializerConfiguration::getConditionalTransferFeeScalarAsAttributes(),
                'RecipientClub' => CommonXmlSerializerConfiguration::getClubScalarAsAttributes(),
                'FeeDetails' => CommonXmlSerializerConfiguration::getTransferFeeDetailsScalarAsAttributes(),
            ]
        );
    }

    public static function getMappings(): array
    {
        return array_merge(
            PersonLocalXmlSerializerConfiguration::getMappings(),
            [
                'PersonLocal' => PersonLocal::class,
                'TransferCertificate' => DocumentEmbedded::class,
                'TransferAgreement' => DocumentEmbedded::class,
                'EmploymentContract' => EmploymentContract::class,
                'EmploymentContractDocument' => DocumentEmbedded::class,
                'WorkPermit' => WorkPermit::class,
                'WorkPermitDocument' => DocumentEmbedded::class,
                'ResidencePermit' => ResidencePermit::class,
                'ResidencePermitDocument' => DocumentEmbedded::class,
                'ReleasingClub' => Club::class,
                'EngagingClub' => Club::class,
                'FixedTransferFee' => FixedTransferFee::class,
                'ConditionalTransferFee' => ConditionalTransferFee::class,
                'ReleaseBuyoutFee' => ReleaseBuyoutFee::class,
                'FeeDetails' => TransferFeeDetails::class,
                'RecipientClub' => Club::class
            ]
        );
    }

    public static function getTagmap(): array
    {
        return array_merge(
            PersonLocalXmlSerializerConfiguration::getTagmap(),
            [
                TransferFeeDetails::class => 'TransferFeeDetails',
                ConditionalTransferFee::class => 'ConditionalTransferFee'
            ]
        );
    }
}