<?php

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

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

class FileMediaTypeGuesser extends AbstractAdminRelationTypeGuesser
{
    public function getFormType(): string
    {
        return FileMediaType::class;
    }

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

    public function getMatchingConfigStrings(): array
    {
        return [
            'file_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;
    }
}
