{
  "openapi": "3.0.0",
  "info": {
    "title": "Exposale API",
    "version": "2.0.0",
    "description": "Public API for exhibitions (v2)"
  },

  "paths": {
    "/api/v2/exhibitions": {
      "get": {
        "summary": "Get exhibitions",
        "parameters": [
          { "name": "lang", "in": "query", "schema": { "type": "string", "default": "en" }},
          { "name": "category", "in": "query", "schema": { "type": "integer" }},
          { "name": "country", "in": "query", "schema": { "type": "integer" }},
          { "name": "city", "in": "query", "schema": { "type": "integer" }},
          { "name": "excenter", "in": "query", "schema": { "type": "integer" }},
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 100 }},
          { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 }}
        ],
        "responses": {
          "200": {
            "description": "List of exhibitions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExhibitionsResponse"
                }
              }
            }
          }
        }
      }
    },

    "/api/v2/exhibitions/{id}": {
      "get": {
        "summary": "Get exhibition by ID",
        "parameters": [
          { "name": "lang", "in": "query", "schema": { "type": "string", "default": "en" }},
          { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }}
        ],
        "responses": {
          "200": {
            "description": "Single exhibition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExhibitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/exhibitions/slug/{slug}": {
      "get": {
        "summary": "Get exhibition by slug (SEO friendly)",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Exhibition slug",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "description": "Language code (default: en)",
            "schema": {
              "type": "string",
              "default": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Single exhibition with SEO schema",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExhibitionSeoResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/search": {
      "get": {
        "summary": "Search exhibitions",
        "description": "Full-text search across exhibitions, categories, countries and cities",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Search query (e.g. 'construction germany')",
            "schema": {
              "type": "string",
              "example": "construction germany"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "description": "Language code (default: en)",
            "schema": {
              "type": "string",
              "default": "en"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limit results",
            "schema": {
              "type": "integer",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/search/suggest": {
      "get": {
        "summary": "Search suggestions (autocomplete)",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "cons"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Suggestions list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuggestResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/requests/{id}": {
      "post": {
        "summary": "Send participation request",
        "description": "Submit a request for exhibition participation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request successfully created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/v2/categories": {
      "get": {
        "summary": "Get categories tree",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "schema": { "type": "string", "default": "en" }
          }
        ],
        "responses": {
          "200": {
            "description": "Categories tree",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoriesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/countries": {
      "get": {
        "summary": "Get countries",
        "parameters": [
          { "name": "lang", "in": "query", "schema": { "type": "string", "default": "en" }}
        ],
        "responses": {
          "200": {
            "description": "List of countries",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountriesResponse"
                }
              }
            }
          }
        }
      }
    },

    "/api/v2/cities": {
      "get": {
        "summary": "Get cities",
        "parameters": [
          { "name": "lang", "in": "query", "schema": { "type": "string", "default": "en" }},
          { "name": "country", "in": "query", "schema": { "type": "integer" }}
        ],
        "responses": {
          "200": {
            "description": "List of cities",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CitiesResponse"
                }
              }
            }
          }
        }
      }
    },

    "/api/v2/excenters": {
      "get": {
        "summary": "Get exhibition centers",
        "parameters": [
          { "name": "lang", "in": "query", "schema": { "type": "string", "default": "en" }},
          { "name": "country", "in": "query", "schema": { "type": "integer" }},
          { "name": "city", "in": "query", "schema": { "type": "integer" }}
        ],
        "responses": {
          "200": {
            "description": "List of exhibition centers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExcentersResponse"
                }
              }
            }
          }
        }
      }
    }
  },

  "components": {
    "schemas": {

      "ExhibitionsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Exhibition" }
          },
          "meta": { "$ref": "#/components/schemas/Meta" }
        }
      },

      "ExhibitionResponse": {
        "type": "object",
        "properties": {
          "data": { "$ref": "#/components/schemas/Exhibition" },
          "meta": { "$ref": "#/components/schemas/Meta" }
        }
      },

      "Exhibition": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "name": { "type": "string" },
          "slug": { "type": "string" },
          "url": { "type": "string" },

          "short_description": { "type": "string" },

          "category_name": { "type": "string" },
          "country_name": { "type": "string" },
          "city_name": { "type": "string" },
          "excenter_name": { "type": "string" },

          "start_date": { "type": "string" },
          "finish_date": { "type": "string" },

          "founded_year": { "type": "integer" },
          "visitors_count": { "type": "integer" },
          "participants_count": { "type": "integer" },
          "area_sqm": { "type": "integer" },
          "participating_countries_count": { "type": "integer" },

          "latitude": { "type": "number" },
          "longitude": { "type": "number" },

          "statistics": { "$ref": "#/components/schemas/Statistics" }
        }
      },

      "Statistics": {
        "type": "object",
        "properties": {
          "exhibitors": { "type": "object" },
          "visitors": { "type": "object" },
          "space": { "type": "object" },

          "countries": {
            "type": "object",
            "properties": {
              "total": { "type": "integer" },
              "top": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": { "type": "string" },
                    "count": { "type": "integer" }
                  }
                }
              }
            }
          },

          "economic_sectors": { "type": "object" },
          "visitor_origin_countries": { "type": "object" }
        }
      },

      "ExhibitionSeoResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Exhibition"
          },
          "seo": {
            "$ref": "#/components/schemas/EventSchema"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },

      "EventSchema": {
        "type": "object",
        "properties": {
          "@context": {
            "type": "string",
            "example": "https://schema.org"
          },
          "@type": {
            "type": "string",
            "example": "Event"
          },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "startDate": { "type": "string" },
          "endDate": { "type": "string" },
          "url": { "type": "string" },

          "location": {
            "type": "object",
            "properties": {
              "@type": { "type": "string" },
              "name": { "type": "string" },
              "geo": {
                "type": "object",
                "properties": {
                  "@type": { "type": "string" },
                  "latitude": { "type": "number" },
                  "longitude": { "type": "number" }
                }
              },
              "address": {
                "type": "object",
                "properties": {
                  "@type": { "type": "string" },
                  "addressLocality": { "type": "string" },
                  "addressCountry": { "type": "string" }
                }
              }
            }
          },

          "organizer": {
            "type": "object",
            "properties": {
              "@type": { "type": "string" },
              "name": { "type": "string" }
            }
          },
          "potentialAction": {
            "type": "object",
            "properties": {
              "@type": {
                "type": "string",
                "example": "CommunicateAction"
              },
              "target": {
                "type": "object",
                "properties": {
                  "@type": {
                    "type": "string",
                    "example": "EntryPoint"
                  },
                  "urlTemplate": {
                    "type": "string",
                    "example": "https://exposale.net/api/v2/requests/{id}"
                  },
                  "httpMethod": {
                    "type": "string",
                    "example": "POST"
                  }
                }
              }
            }
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchItem"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/SearchMeta"
          }
        }
      },
      "SearchItem": {
        "type": "object",
        "properties": {
          "exhibition_id": { "type": "integer" },

          "name": { "type": "string" },
          "slug": { "type": "string" },
          "url": { "type": "string" },

          "short_description": { "type": "string" },

          "category_id": { "type": "integer" },
          "category_name": { "type": "string" },

          "country_id": { "type": "integer" },
          "country_name": { "type": "string" },

          "city_id": { "type": "integer" },
          "city_name": { "type": "string" },

          "excenter_id": { "type": "integer" },
          "excenter_name": { "type": "string" },

          "latitude": { "type": "number" },
          "longitude": { "type": "number" },

          "start_date": { "type": "string" },
          "finish_date": { "type": "string" },

          "founded_year": { "type": "integer" },
          "visitors_count": { "type": "integer" },
          "participants_count": { "type": "integer" },
          "area_sqm": { "type": "integer" },
          "participating_countries_count": { "type": "integer" },

          "statistics": {
            "$ref": "#/components/schemas/Statistics"
          }
        }
      },
      "SearchMeta": {
        "type": "object",
        "properties": {
          "q": { "type": "string" },
          "count": { "type": "integer" },
          "lang": { "type": "string" }
        }
      },
      "SuggestResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RequestCreate": {
        "type": "object",
        "required": [
          "organization_name",
          "customer_name",
          "phone_prefix",
          "phone",
          "email"
        ],
        "properties": {
          "organization_name": { "type": "string" },
          "customer_name": { "type": "string" },
          "phone_prefix": { "type": "string" },
          "phone": { "type": "string" },
          "email": { "type": "string" }
        }
      },
      "RequestResponse": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean" },
          "message": { "type": "string" },
          "data": {
            "type": "object",
            "properties": {
              "id": { "type": "integer" }
            }
          }
        }
      },
      "CategoriesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryTree"
            }
          },
          "meta": { "$ref": "#/components/schemas/Meta" }
        }
      },

      "CategoryTree": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "name": { "type": "string" },
          "children": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": { "type": "integer" },
                "name": { "type": "string" }
              }
            }
          }
        }
      },

      "CountriesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Country" }
          },
          "meta": { "$ref": "#/components/schemas/Meta" }
        }
      },

      "Country": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "iso_code": { "type": "string" },
          "name": { "type": "string" }
        }
      },

      "CitiesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/City" }
          },
          "meta": { "$ref": "#/components/schemas/Meta" }
        }
      },

      "City": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "country_id": { "type": "integer" },
          "name": { "type": "string" },
          "country_name": { "type": "string" }
        }
      },

      "ExcentersResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Excenter" }
          },
          "meta": { "$ref": "#/components/schemas/Meta" }
        }
      },

      "Excenter": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "city_id": { "type": "integer" },
          "country_id": { "type": "integer" },

          "name": { "type": "string" },
          "city_name": { "type": "string" },
          "country_name": { "type": "string" },

          "latitude": { "type": "number" },
          "longitude": { "type": "number" }
        }
      },

      "Meta": {
        "type": "object",
        "properties": {
          "total": { "type": "integer" },
          "limit": { "type": "integer" },
          "page": { "type": "integer" },
          "pages": { "type": "integer" },
          "count": { "type": "integer" },
          "lang": { "type": "string" }
        }
      }
    }
  }
}