from logging import Logger

from typing import Optional


class Configurations(object):
    def __init__(
        self,
        required_services=None,         # type: Optional[str]
        service_name=None,              # type: Optional[str]
        persistence_name=None,          # type: Optional[str]
        store_id=None,                  # type: Optional[int]
        logger=None,                    # type: Optional[Logger]
        base_url=None,                  # type: Optional[str]
        api_key=None,                   # type: Optional[str]
        id_type=None,                   # type: Optional[str]
        is_loyalty_enabled=True,        # type: Optional[bool]
        partner_retry_policy=None,      # type: Optional[RetryPolicy]
    ):
        # type: (...) -> None

        self.required_services = required_services
        self.service_name = service_name
        self.persistence_name = persistence_name
        self.store_id = store_id
        self.logger = logger
        self.base_url = base_url
        self.api_key = api_key
        self.id_type = id_type
        self.is_loyalty_enabled = is_loyalty_enabled
        self.endpoints = Endpoints()
        if partner_retry_policy is None:
            partner_retry_policy = RetryPolicy(
                count=1,
                sleep=1,
            )
        self.partner_retry_policy = partner_retry_policy


class Endpoints(object):
    def __init__(self):
        self.retrieve_loyalty_id = None
        self.get_benefit = None
        self.burn_benefit = None
        self.unlock_benefit = None


class RetryPolicy(object):
    def __init__(
        self,
        count,   # type: int
        sleep,   # type: int
    ):
        self.count = count
        self.sleep = sleep
