<?php

namespace Symfony\Config\SuluForm;

use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;

/**
 * This class is automatically generated to help in creating a config.
 */
class MediaConfig 
{
    private $protected;
    private $collectionStrategy;
    private $_usedProperties = [];

    /**
     * Enables the media protection so media are only downloadable from the admin.
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function protected($value): static
    {
        $this->_usedProperties['protected'] = true;
        $this->protected = $value;

        return $this;
    }

    /**
     * @default 'single'
     * @param ParamConfigurator|'single'|'tree' $value
     * @return $this
     */
    public function collectionStrategy($value): static
    {
        $this->_usedProperties['collectionStrategy'] = true;
        $this->collectionStrategy = $value;

        return $this;
    }

    public function __construct(array $value = [])
    {
        if (array_key_exists('protected', $value)) {
            $this->_usedProperties['protected'] = true;
            $this->protected = $value['protected'];
            unset($value['protected']);
        }

        if (array_key_exists('collection_strategy', $value)) {
            $this->_usedProperties['collectionStrategy'] = true;
            $this->collectionStrategy = $value['collection_strategy'];
            unset($value['collection_strategy']);
        }

        if ([] !== $value) {
            throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($value)));
        }
    }

    public function toArray(): array
    {
        $output = [];
        if (isset($this->_usedProperties['protected'])) {
            $output['protected'] = $this->protected;
        }
        if (isset($this->_usedProperties['collectionStrategy'])) {
            $output['collection_strategy'] = $this->collectionStrategy;
        }

        return $output;
    }

}
