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

"""
swaggerpetstoreopenapi30

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

from apimatic_core.authentication.header_auth import HeaderAuth


class CustomHeaderAuthentication(HeaderAuth):

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

        """
        return "CustomHeaderAuthentication: api_key is undefined."

    def __init__(self, custom_header_authentication_credentials):
        auth_params = {}
        if custom_header_authentication_credentials is not None \
                and custom_header_authentication_credentials.api_key is not None:
            auth_params["api_key"] = custom_header_authentication_credentials.api_key
        super().__init__(auth_params=auth_params)


class CustomHeaderAuthenticationCredentials:

    @property
    def api_key(self):
        return self._api_key

    def __init__(self, api_key):
        if api_key is None:
            raise ValueError('api_key cannot be None')
        self._api_key = api_key

    def clone_with(self, api_key=None):
        return CustomHeaderAuthenticationCredentials(api_key or self.api_key)
