<?php

namespace AutoAdmin\Bundle\Media\Admin\Form\TypeGuesser;

use AutoAdmin\Bundle\Admin\Form\TypeGuesser\Guesser\Relation\AbstractAdminRelationTypeGuesser;
use AutoAdmin\Bundle\Media\Form\Type\Media\LinkedMediaType;
use Doctrine\ORM\Mapping\OneToOne;

class LinkedMediaTypeGuesser extends AbstractAdminRelationTypeGuesser
{
    public function getFormType(): string
    {
        return LinkedMediaType::class;
    }

    public function getRelationType(): string
    {
        return OneToOne::class;
    }

    public function getMatchingConfigStrings(): array
    {
        return [
            'linked_media',
        ];
    }

    public function getDefaultRelationFormTypeOptions(): array
    {
        return [];
    }

    public function getDefaultFormTypeOptions(): array
    {
        return array_merge(
            $this->getDefaultRelationFormTypeOptions(),
        );
    }

    public function getMatchingPropertyTypes(): array
    {
        return [
            $this->getTargetEntity(),
            'object',
        ];
    }

    public function priority(): int
    {
        return 40;
    }
}
