{
  "openapi": "3.0.0",
  "info": {
    "title": "email-api",
    "version": "0.0.1",
    "description": "Api hpoffice",
    "contact": {
      "name": "HpOffice.cl",
      "email": "soporte@hpoffice.cl"
    }
  },
  "paths": {
    "/email": {
      "post": {
        "x-controller-name": "EmailController",
        "x-operation-name": "sendEmail",
        "tags": [
          "EmailController"
        ],
        "responses": {
          "200": {
            "description": "Return value of EmailController.sendEmail"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailData"
              }
            }
          }
        },
        "operationId": "EmailController.sendEmail"
      }
    },
    "/emailTemplate": {
      "post": {
        "x-controller-name": "EmailController",
        "x-operation-name": "sendEmailFromTemplate",
        "tags": [
          "EmailController"
        ],
        "responses": {
          "200": {
            "description": "Return value of EmailController.sendEmailFromTemplate"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailDataTemplate"
              }
            }
          }
        },
        "operationId": "EmailController.sendEmailFromTemplate"
      }
    }
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "components": {
    "schemas": {
      "EmailAddress": {
        "title": "EmailAddress",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email",
            "minLength": 5,
            "maxLength": 50,
            "transform": [
              "toLowerCase"
            ]
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      },
      "Attach": {
        "title": "Attach",
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "The base64-encoded string of the file."
          },
          "filename": {
            "type": "string",
            "description": "The file name including the extension."
          },
          "type": {
            "type": "string",
            "description": "**No need to send it** The Type MIME of the file is generate for the API."
          },
          "disposition": {
            "type": "string"
          },
          "content_id": {
            "type": "string"
          }
        },
        "required": [
          "content",
          "filename"
        ],
        "additionalProperties": false
      },
      "EmailData": {
        "title": "EmailData",
        "type": "object",
        "properties": {
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "minLength": 5,
              "maxLength": 50,
              "transform": [
                "toLowerCase"
              ]
            }
          },
          "from": {
            "$ref": "#/components/schemas/EmailAddress"
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "The email's to send at copy of this mail.",
              "format": "email",
              "minLength": 5,
              "maxLength": 50,
              "transform": [
                "toLowerCase"
              ]
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "The email's to send hiding copy of this mail.",
              "format": "email",
              "minLength": 5,
              "maxLength": 50,
              "transform": [
                "toLowerCase"
              ]
            }
          },
          "subject": {
            "type": "string",
            "description": "The subject's of email.",
            "minLength": 5,
            "maxLength": 100,
            "errorMessage": "The subject of email is not present"
          },
          "text": {
            "type": "string",
            "description": "the content equivalent to the html in plain text"
          },
          "html": {
            "type": "string",
            "description": "The HTML of the email."
          },
          "template_id": {
            "type": "string",
            "description": "The template ID of the email. If themplate_ID pressent "
          },
          "custom_args": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "The HTML of the the files that will be sent as attachments along with the mail."
            }
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Attach"
            }
          }
        },
        "required": [
          "to",
          "subject",
          "text",
          "html"
        ],
        "additionalProperties": false
      },
      "EmailDataTemplate": {
        "title": "EmailDataTemplate",
        "type": "object",
        "properties": {
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "minLength": 5,
              "maxLength": 50,
              "transform": [
                "toLowerCase"
              ]
            }
          },
          "from": {
            "$ref": "#/components/schemas/EmailAddress"
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "The email's to send at copy of this mail.",
              "format": "email",
              "minLength": 5,
              "maxLength": 50,
              "transform": [
                "toLowerCase"
              ]
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "The email's to send hiding copy of this mail.",
              "format": "email",
              "minLength": 5,
              "maxLength": 50,
              "transform": [
                "toLowerCase"
              ]
            }
          },
          "template_id": {
            "type": "string",
            "description": "The template ID of the email. If themplate_ID pressent "
          },
          "dynamicTemplateData": {
            "type": "object",
            "description": "The HTML of the the files that will be sent as attachments along with the mail."
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Attach"
            }
          }
        },
        "required": [
          "to"
        ],
        "additionalProperties": false
      }
    }
  }
}