# -*- coding: utf-8 -*-

"""
swaggerpetstore

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""


class CustomHeaderAuthentication:

    def __init__(self, api_key):
        self._api_key = api_key

    def validate_arguments(self):
        if self._api_key:
            return True
        return False

    def apply(self, http_request):
        """ Add custom authentication to the request.

        Args:
            http_request (HttpRequest): The HttpRequest object to which
                authentication will be added.

        """
        http_request.add_header("api_key", self._api_key)

    def error_message(self):
        """Display error message on occurrence of authentication faliure
        in CustomHeaderAuthentication

        """
        return "CustomHeaderAuthentication: _api_key is undefined."
