services:
    ewz_recaptcha.locale.resolver:
        class: EWZ\Bundle\RecaptchaBundle\Locale\LocaleResolver
        public: false
        arguments:
            - '%ewz_recaptcha.locale_key%'
            - '%ewz_recaptcha.locale_from_request%'
            - '@request_stack'

    ewz_recaptcha.form.type:
        class: EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType
        public: true
        arguments:
            - '%ewz_recaptcha.public_key%'
            - '%ewz_recaptcha.enabled%'
            - '%ewz_recaptcha.ajax%'
            - '@ewz_recaptcha.locale.resolver'
            - '%ewz_recaptcha.api_host%'
        tags:
            - { name: form.type }

    ewz_recaptcha.validator.true:
        class: EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrueValidator
        public: true
        arguments:
            - '%ewz_recaptcha.enabled%'
            - '@ewz_recaptcha.recaptcha'
            - '@request_stack'
            - '%ewz_recaptcha.verify_host%'
            - '@?security.authorization_checker'
            - '%ewz_recaptcha.trusted_roles%'
        tags:
            - { name: validator.constraint_validator, alias: 'ewz_recaptcha.true' }

    ewz_recaptcha.recaptcha:
        class: ReCaptcha\ReCaptcha
        public: false
        arguments:
            - '%ewz_recaptcha.private_key%'
            - '@ewz_recaptcha.extension.recaptcha.request_method.post'

    ewz_recaptcha.extension.recaptcha.request_method.post:
        class: EWZ\Bundle\RecaptchaBundle\Extension\ReCaptcha\RequestMethod\Post
        public: false
        arguments:
            - 'https://%ewz_recaptcha.api_host%'
            - '%ewz_recaptcha.timeout%'

    ewz_recaptcha.extension.recaptcha.request_method.proxy_post:
        class: EWZ\Bundle\RecaptchaBundle\Extension\ReCaptcha\RequestMethod\ProxyPost
        public: false
        arguments:
            - '%ewz_recaptcha.http_proxy%'
            - 'https://%ewz_recaptcha.api_host%'
            - '%ewz_recaptcha.timeout%'

    ewz_recaptcha.v3.form.type:
        class: EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaV3Type
        public: true
        arguments:
            - '%ewz_recaptcha.public_key%'
            - '%ewz_recaptcha.enabled%'
            - '%ewz_recaptcha.hide_badge%'
            - '%ewz_recaptcha.api_host%'
        tags:
            - { name: form.type }

    ewz_recaptcha.validator.v3.true:
        class: EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrueValidatorV3
        public: true
        arguments:
            - '%ewz_recaptcha.enabled%'
            - '%ewz_recaptcha.private_key%'
            - '%ewz_recaptcha.score_threshold%'
            - '@request_stack'
            - '@logger'
        tags:
            - { name: validator.constraint_validator, alias: 'ewz_recaptcha.v3.true' }

