{
  "openapi": "3.1.0",
  "info": {
    "title": "Next Code Contact API",
    "description": "API for submitting contact form inquiries to Next Code software development agency",
    "version": "1.0.0",
    "contact": {
      "name": "Next Code",
      "url": "https://next-code.it",
      "email": "info@next-code.it"
    },
    "license": {
      "name": "All Rights Reserved",
      "url": "https://next-code.it"
    }
  },
  "servers": [
    {
      "url": "https://api.web3forms.com",
      "description": "Web3Forms API Server"
    }
  ],
  "paths": {
    "/submit": {
      "post": {
        "summary": "Submit contact form",
        "description": "Sends a contact form submission to Next Code via email. No authentication required.",
        "operationId": "submitContactForm",
        "tags": ["Contact"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactForm"
              },
              "examples": {
                "standard": {
                  "summary": "Standard contact form submission",
                  "value": {
                    "access_key": "6a69d1c6-21b5-451a-8a2a-6dd27a689d8a",
                    "subject": "Nuovo contatto da Next Code",
                    "from_name": "Next Code Website",
                    "name": "Mario Rossi",
                    "company": "Azienda S.r.l.",
                    "email": "mario@azienda.it",
                    "message": "Vorrei sviluppare un gestionale personalizzato per la mia azienda."
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ContactForm"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact form successfully submitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Successful submission",
                    "value": {
                      "success": true,
                      "message": "Email sent successfully"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - Invalid form data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_fields": {
                    "summary": "Missing required fields",
                    "value": {
                      "success": false,
                      "message": "Missing required fields"
                    }
                  },
                  "invalid_email": {
                    "summary": "Invalid email format",
                    "value": {
                      "success": false,
                      "message": "Invalid email address"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Invalid access key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalid_key": {
                    "summary": "Invalid or missing access key",
                    "value": {
                      "success": false,
                      "message": "Invalid access key"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "rate_limit": {
                    "summary": "Rate limit exceeded",
                    "value": {
                      "success": false,
                      "message": "Too many requests. Please try again later."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "server_error": {
                    "summary": "Server error",
                    "value": {
                      "success": false,
                      "message": "Internal server error. Please try again."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContactForm": {
        "type": "object",
        "required": ["access_key", "name", "email", "message"],
        "properties": {
          "access_key": {
            "type": "string",
            "description": "Web3Forms access key for Next Code",
            "example": "6a69d1c6-21b5-451a-8a2a-6dd27a689d8a"
          },
          "subject": {
            "type": "string",
            "description": "Email subject line",
            "example": "Nuovo contatto da Next Code",
            "default": "Nuovo contatto da Next Code"
          },
          "from_name": {
            "type": "string",
            "description": "Sender name for the email",
            "example": "Next Code Website",
            "default": "Next Code Website"
          },
          "name": {
            "type": "string",
            "description": "Full name of the person contacting",
            "example": "Mario Rossi"
          },
          "company": {
            "type": "string",
            "description": "Company name (optional)",
            "example": "Azienda S.r.l."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Email address of the sender",
            "example": "mario@azienda.it"
          },
          "message": {
            "type": "string",
            "description": "Message describing the project or problem",
            "example": "Vorrei sviluppare un gestionale personalizzato per la mia azienda."
          }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string",
            "example": "Email sent successfully"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "message": {
            "type": "string",
            "description": "Error description"
          },
          "code": {
            "type": "string",
            "description": "Error code (optional)"
          }
        }
      }
    },
    "securitySchemes": {}
  },
  "tags": [
    {
      "name": "Contact",
      "description": "Contact form submission endpoints"
    }
  ],
  "externalDocs": {
    "description": "Next Code Website",
    "url": "https://next-code.it"
  }
}
