# Region configuration
NA_REGION_CODE = "NA"
SP_API_NA_ENDPOINT = "https://sellingpartnerapi-na.amazon.com"
EU_REGION_CODE = "EU"
SP_API_EU_ENDPOINT = "https://sellingpartnerapi-eu.amazon.com"
FE_REGION_CODE = "FE"
SP_API_FE_ENDPOINT = "https://sellingpartnerapi-fe.amazon.com"


# Sandbox configuration
SANDBOX_REGION_CODE = "SANDBOX"
SP_API_NA_SANDBOX_ENDPOINT = "https://sandbox.sellingpartnerapi-na.amazon.com"


# Region to endpoint mapping
VALID_SP_API_REGION_CONFIG = {
    NA_REGION_CODE: SP_API_NA_ENDPOINT,
    EU_REGION_CODE: SP_API_EU_ENDPOINT,
    FE_REGION_CODE: SP_API_FE_ENDPOINT,
    SANDBOX_REGION_CODE: SP_API_NA_SANDBOX_ENDPOINT
}


# Login With Amazon Configuration
LWA_ENDPOINT = "https://api.amazon.com/auth/o2/token"


# Lambda Environment Variables
SP_API_APP_CREDENTIALS_SECRET_ARN_ENV_VARIABLE = "SP_API_APP_CREDENTIALS_SECRET_ARN"


# Generic Lambda Input Parameters
REGION_CODE_KEY_NAME = "RegionCode"
REFRESH_TOKEN_KEY_NAME = "RefreshToken"
SECRETS_MANAGER_KEY_NAME = "secretsmanager"


# API Type
DATA_KIOSK_API_TYPE = "datakiosk"
NOTIFICATIONS_API_TYPE = "notifications"


# Lambda Constants
QUERY_CODE_KEY_NAME = "Query"
QUERY_ID_KEY_NAME = "QueryId"
QUERY_HASH_KEY_NAME = "QueryHash"
START_DATE_KEY_NAME = "StartDate"
MINUTE_RATE_KEY_NAME = "MinuteRate"
ACCOUNT_ID_KEY_NAME = "AccountId"
OPERATION_KEY_NAME = "Operation"
OPERATION_CREATE_KEY_NAME = "CREATE"
OPERATION_DELETE_KEY_NAME = "DELETE"
SCHEDULER_ARN_KEY_NAME = "SchedulerArn"


# Notification Attributes
NOTIFICATION_TYPE_DK = "DATA_KIOSK_QUERY_PROCESSING_FINISHED"
LWA_NOTIFICATIONS_SCOPE = "sellingpartnerapi::notifications"
NOTIFICATION_KEY_NOTIFICATION_TYPE = "notificationType"
SUB_NOTIFICATION_KEY_NOTIFICATION_TYPE = "NotificationType"
NOTIFICATION_KEY_QUERY_ID = "queryId"
NOTIFICATION_KEY_QUERY = "query"
NOTIFICATION_KEY_PROCESSING_STATUS = "processingStatus"
NOTIFICATION_KEY_DATA_DOCUMENT_ID = "dataDocumentId"
NOTIFICATION_KEY_ERROR_DOCUMENT_ID = "errorDocumentId"
NOTIFICATION_KEY_ACCOUNT_ID = "accountId"
NOTIFICATION_KEY_FATAL_PROCESSING = "Fatal"

# State Machine Attributes
STATE_MACHINE_ARN_ENV_VARIABLE = "STATE_MACHINE_ARN"
STATE_MACHINE_KEY_DOCUMENT_ID = "documentId"
STATE_MACHINE_KEY_PROCESSING_STATUS = "processingStatus"
STATE_MACHINE_KEY_DOCUMENT = "document"
STATE_MACHINE_KEY_QUERY = "query"
STATE_MACHINE_KEY_QUERY_ID = "queryId"
STATE_MACHINE_KEY_ACCOUNT_ID = "accountId"


# AWS Attributes
AWS_STEP_FUNCTIONS_CLIENT_NAME = "stepfunctions"
AWS_STEP_FUNCTIONS_EXECUTION_ARN_NAME = "executionArn"


# Env Variables
REFRESH_TOKEN_ARN_ENV_VARIABLE = "REFRESH_TOKEN"
REGION_CODE_ARN_ENV_VARIABLE = "REGION_CODE"
RANDOM_SUFFIX_ENV_VARIABLE = "RANDOM_SUFFIX"
SCHEDULER_GROUP_NAME = "sp-api-dk-scheduler-group-"
SCHEDULER_QUERY_NAME = "datakiosk-query"
SQS_QUEUE_ARN_ENV_VARIABLE = "SQS_QUEUE_ARN"
DATAKIOSK_DOCUMENTS_S3_BUCKET_NAME_ENV_VARIABLE = "DATAKIOSK_DOCUMENTS_S3_BUCKET_NAME"
QUERY_ITEMS_TABLE_NAME_ENV_VARIABLE = "QUERY_ITEMS_TABLE_NAME"

# Dynamo DB
SCHEDULED_QUERIES_TABLE_ENV_NAME = "SCHEDULED_QUERIES_TABLE_NAME"
CREATE_SCHEDULE_ROLE_ARN_ENV_NAME = "CREATE_SCHEDULE_ROLE_ARN"
CREATE_QUERY_LAMBDA_FUNCTION_ARN_ENV_NAME = "CREATE_QUERY_LAMBDA_FUNCTION_ARN"
CREATE_SCHEDULED_QUERY_LAMBDA_FUNCTION_ARN_ENV_NAME = "FORMAT_SCHEDULE_LAMBDA_FUNCTION_ARN"
AWS_DYNAMO_DB_CLIENT_KEY_NAME = "dynamodb"
SCHEDULED_QUERIES_TABLE_QUERY_HASH_KEY_NAME = "QueryHash"
SCHEDULED_QUERIES_TABLE_ACCOUNT_ID_KEY_NAME = "AccountId"

# Query Constants
QUERY_SCHEMA_DATASET_FILE_NAME = "datasets.json"
QUERY_SCHEMA_START_DATE = "StartDate"
QUERY_SCHEMA_END_DATE = "EndDate"
QUERY_SCHEMA_DATE_FORMAT = "DateFormat"
QUERY_SCHEMA_DATA_RELOAD_PERIOD = "DataReloadPeriod"
QUERY_SCHEMA_FIELD_NAMES = "FieldNames"
SCHEDULER_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S"
