{
  "openapi": "3.1.0",
  "info": {
    "title": "Azan Catalog API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api-dev-0289e28325b7.catalog.azan-dev.pl/",
      "description": "Development"
    }
  ],
  "paths": {
    "/v1/products/export/{format}": {
      "post": {
        "tags": [
          "Export"
        ],
        "summary": "Create export",
        "description": "Submit asynchronous export job",
        "operationId": "handler_v1_products_export__format__post",
        "parameters": [
          {
            "description": "Export format",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/ExportFormatEnum",
              "description": "Export format"
            },
            "name": "format",
            "in": "path"
          }
        ],
        "responses": {
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "200": {
            "description": "Export data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/product": {
      "get": {
        "tags": [
          "Product"
        ],
        "summary": "Retrieves product data",
        "description": "Load product data by SKU",
        "operationId": "handler_v1_product_get",
        "parameters": [
          {
            "description": "SKU",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Sku",
              "description": "SKU"
            },
            "name": "sku",
            "in": "query"
          }
        ],
        "responses": {
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "200": {
            "description": "Product data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "example": {
                  "message": "SKU is required"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "example": {
                  "message": "Forbidden - SKU not permitted"
                }
              }
            }
          },
          "404": {
            "description": "Product not found",
            "content": {
              "application/json": {
                "example": {
                  "message": "Product not found"
                }
              }
            }
          }
        }
      }
    },
    "/v1/products": {
      "get": {
        "tags": [
          "Product"
        ],
        "summary": "Retrieves list of products",
        "description": "Load list of products SKUs",
        "operationId": "handler_v1_products_get",
        "parameters": [
          {
            "description": "Limit",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0.0,
              "title": "Limit",
              "description": "Limit",
              "default": 100
            },
            "name": "limit",
            "in": "query"
          },
          {
            "description": "Cursor",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Cursor",
              "description": "Cursor"
            },
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "200": {
            "description": "Product SKUs list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductsListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/products/export": {
      "get": {
        "tags": [
          "Export"
        ],
        "summary": "Get export status",
        "description": "Returns export status with download URL if export is done",
        "operationId": "handler_v1_products_export_get",
        "parameters": [
          {
            "description": "Export ID",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Export Id",
              "description": "Export ID"
            },
            "name": "export_id",
            "in": "query"
          }
        ],
        "responses": {
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "200": {
            "description": "Export data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ExportFormatEnum": {
        "type": "string",
        "enum": [
          "csv",
          "json"
        ],
        "title": "ExportFormatEnum"
      },
      "ExportResponse": {
        "properties": {
          "export_id": {
            "type": "string",
            "title": "Export Id"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "download_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Download Url"
          },
          "products_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Products Count"
          }
        },
        "type": "object",
        "required": [
          "export_id",
          "status"
        ],
        "title": "ExportResponse"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ProductResponse": {
        "properties": {
          "sku": {
            "type": "string",
            "title": "Sku"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "template": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Template"
          },
          "categories": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Categories"
          },
          "attributes": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Attributes"
          },
          "children": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Children"
          }
        },
        "type": "object",
        "required": [
          "sku"
        ],
        "title": "ProductResponse"
      },
      "ProductsListResponse": {
        "properties": {
          "products": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Products"
          },
          "cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cursor"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "products",
          "cursor",
          "has_more"
        ],
        "title": "ProductsListResponse"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "apikey": {
        "type": "apiKey",
        "description": "API Key",
        "in": "header",
        "name": "X-Api-Key",
        "x-amazon-apigateway-authorizer": "custom"
      }
    }
  },
  "security": [
    {
      "apikey": []
    }
  ]
}