<?php

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

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

class FileTypeGuesser extends AbstractAdminRelationTypeGuesser
{
    public function getFormType(): string
    {
        return FileType::class;
    }

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

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

    public function getDefaultRelationFormTypeOptions(): array
    {
        return [
            'multiple' => false,
            'expanded' => false,
        ];
    }

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

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