<?php

namespace Entity\Model\Metadata;

class PartnFournissExtId extends EntityMeta
{
    public function __construct(string $fournissId, string $partnId, string $externalId)
    {
        parent::__construct(
            'FOUR',
            $fournissId,
            $this->getStructIdFromPartn($partnId),
            [
                'extId' => $externalId,
            ]
        );
    }

    public function getExternalId() :string
    {
        return $this->getFieldMap()['extId'];
    }

    private function getStructIdFromPartn(string $partnId) :int
    {
        switch ($partnId) {
            case 'OFA':
                return 0;
        }
        throw new \Exception('Invalid code Partenaire "'.$partnId.'"');
    }
}
