{
  "components": {
    "schemas": {
      "MmsDownloadedAttachment": {
        "properties": {
          "contentType": {
            "description": "MIME type of the attachment (e.g. image/jpeg, audio/amr).",
            "type": "string"
          },
          "data": {
            "description": "Base64-encoded attachment data, null if unavailable.",
            "format": "byte",
            "nullable": true,
            "pattern": "^[\\w\\d+\\/=]*$",
            "type": "string"
          },
          "name": {
            "description": "Filename of the attachment, if present.",
            "nullable": true,
            "type": "string"
          },
          "partId": {
            "description": "The _id from content://mms/part.",
            "type": "integer"
          },
          "size": {
            "description": "Size in bytes, 0 if unknown.",
            "nullable": true,
            "type": "integer"
          }
        },
        "required": [
          "partId",
          "contentType"
        ],
        "type": "object"
      },
      "MmsDownloadedPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SmsEventPayload"
          },
          {
            "properties": {
              "attachments": {
                "description": "Metadata for non-text MMS parts, including optional Base64 content.",
                "items": {
                  "$ref": "#/components/schemas/MmsDownloadedAttachment"
                },
                "type": "array"
              },
              "body": {
                "description": "Aggregated text content of the MMS message.",
                "nullable": true,
                "type": "string"
              },
              "receivedAt": {
                "description": "The timestamp when the MMS message was received.",
                "format": "date-time",
                "type": "string"
              },
              "subject": {
                "description": "Message subject line.",
                "nullable": true,
                "type": "string"
              }
            },
            "required": [
              "attachments",
              "receivedAt"
            ],
            "type": "object"
          }
        ],
        "description": "Payload of `mms:downloaded` event. Includes message body and attachment metadata extracted from the content provider after the MMS has been fully downloaded.",
        "title": "MmsDownloadedPayload"
      },
      "MmsReceivedPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SmsEventPayload"
          },
          {
            "properties": {
              "contentClass": {
                "description": "MMS content classification",
                "type": "string"
              },
              "receivedAt": {
                "description": "The timestamp when the MMS message was received.",
                "format": "date-time",
                "type": "string"
              },
              "size": {
                "description": "Attachment size in bytes",
                "type": "integer"
              },
              "subject": {
                "description": "Message subject line",
                "nullable": true,
                "type": "string"
              },
              "transactionId": {
                "description": "Unique MMS transaction identifier",
                "type": "string"
              }
            },
            "type": "object"
          }
        ],
        "description": "Payload of `mms:received` event.",
        "title": "MmsReceivedPayload"
      },
      "SmsDataReceivedPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SmsEventPayload"
          },
          {
            "properties": {
              "data": {
                "description": "Base64-encoded content of the SMS message received.",
                "format": "byte",
                "pattern": "^[\\w\\d+\\/=]*$",
                "type": "string"
              },
              "receivedAt": {
                "description": "The timestamp when the SMS message was received.",
                "format": "date-time",
                "type": "string"
              }
            },
            "type": "object"
          }
        ],
        "description": "Payload of `sms:data-received` event.",
        "title": "SmsDataReceivedPayload"
      },
      "SmsDeliveredPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SmsEventPayload"
          },
          {
            "properties": {
              "deliveredAt": {
                "description": "The timestamp when the SMS message was delivered.",
                "format": "date-time",
                "type": "string"
              }
            },
            "type": "object"
          }
        ],
        "description": "Payload of `sms:delivered` event.",
        "title": "SmsDeliveredPayload"
      },
      "SmsEventPayload": {
        "description": "Base payload for message-related events.",
        "properties": {
          "messageId": {
            "description": "The unique identifier of the message.",
            "type": "string"
          },
          "phoneNumber": {
            "description": "The phone number of the sender (for incoming messages) or recipient (for outgoing messages).",
            "type": "string"
          },
          "recipient": {
            "description": "The phone number of the message recipient. For incoming messages, this is the device's/SIM's phone number that received the message; for outgoing messages, this is the recipient's phone number. May be `null` for device's phone number.",
            "nullable": true,
            "type": "string"
          },
          "sender": {
            "description": "The phone number of the message sender. For incoming messages, this is the external sender; for outgoing messages, this is the device's phone number. May be `null` for device's phone number.",
            "type": "string"
          },
          "simNumber": {
            "description": "The SIM card number that sent or received the SMS. May be `null` if the SIM cannot be determined or the default was used.",
            "nullable": true,
            "type": "integer"
          }
        },
        "title": "MessageEventPayload",
        "type": "object"
      },
      "SmsFailedPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SmsEventPayload"
          },
          {
            "properties": {
              "failedAt": {
                "description": "The timestamp when the SMS message failed.",
                "format": "date-time",
                "type": "string"
              },
              "reason": {
                "description": "The reason for the failure.",
                "type": "string"
              }
            },
            "type": "object"
          }
        ],
        "description": "Payload of `sms:failed` event.",
        "title": "SmsFailedPayload"
      },
      "smsgateway.DataMessage": {
        "properties": {
          "data": {
            "description": "Data is the base64-encoded payload.",
            "example": "SGVsbG8gV29ybGQh",
            "format": "byte",
            "maxLength": 65535,
            "minLength": 4,
            "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
            "type": "string"
          },
          "port": {
            "description": "Port is the destination port.",
            "example": 53739,
            "maximum": 65535,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "data",
          "port"
        ],
        "type": "object"
      },
      "smsgateway.Device": {
        "properties": {
          "createdAt": {
            "description": "Created at (read only)",
            "example": "2020-01-01T00:00:00Z",
            "type": "string"
          },
          "deletedAt": {
            "description": "Deleted at (read only)",
            "example": "2020-01-01T00:00:00Z",
            "type": "string"
          },
          "id": {
            "description": "ID",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "type": "string"
          },
          "lastSeen": {
            "description": "Last seen at (read only)",
            "example": "2020-01-01T00:00:00Z",
            "type": "string"
          },
          "name": {
            "description": "Name",
            "example": "My Device",
            "type": "string"
          },
          "updatedAt": {
            "description": "Updated at (read only)",
            "example": "2020-01-01T00:00:00Z",
            "type": "string"
          }
        },
        "type": "object"
      },
      "smsgateway.DeviceSettings": {
        "properties": {
          "encryption": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.SettingsEncryption"
              }
            ],
            "description": "Encryption contains settings related to message encryption.",
            "type": "object"
          },
          "gateway": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.SettingsGateway"
              }
            ],
            "description": "Gateway contains settings related to the gateway.",
            "type": "object"
          },
          "logs": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.SettingsLogs"
              }
            ],
            "description": "Logs contains settings related to logging.",
            "type": "object"
          },
          "messages": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.SettingsMessages"
              }
            ],
            "description": "Messages contains settings related to message handling.",
            "type": "object"
          },
          "ping": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.SettingsPing"
              }
            ],
            "description": "Ping contains settings related to ping functionality.",
            "type": "object"
          },
          "webhooks": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.SettingsWebhooks"
              }
            ],
            "description": "Webhooks contains settings related to webhook functionality.",
            "type": "object"
          }
        },
        "type": "object"
      },
      "smsgateway.ErrorResponse": {
        "properties": {
          "code": {
            "description": "Error code",
            "type": "integer"
          },
          "data": {
            "description": "Error context",
            "type": "object"
          },
          "message": {
            "description": "Error message",
            "example": "An error occurred",
            "type": "string"
          }
        },
        "type": "object"
      },
      "smsgateway.GetMessageResponse": {
        "properties": {
          "dataMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.DataMessage"
              }
            ],
            "description": "Present only when `includeContent=true` and the message type is data.",
            "type": "object"
          },
          "deviceId": {
            "description": "Device ID",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 21,
            "type": "string"
          },
          "hashedMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.HashedMessage"
              }
            ],
            "description": "Hashed message content, if isHashed is true",
            "type": "object"
          },
          "id": {
            "description": "Message ID",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 36,
            "type": "string"
          },
          "isEncrypted": {
            "description": "Encrypted",
            "example": false,
            "type": "boolean"
          },
          "isHashed": {
            "description": "Hashed",
            "example": false,
            "type": "boolean"
          },
          "recipients": {
            "description": "Recipients states",
            "items": {
              "$ref": "#/components/schemas/smsgateway.RecipientState"
            },
            "minItems": 1,
            "type": "array"
          },
          "state": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.ProcessingState"
              }
            ],
            "description": "State",
            "example": "Pending",
            "type": "object"
          },
          "states": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "History of states",
            "type": "object"
          },
          "textMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.TextMessage"
              }
            ],
            "description": "Present only when `includeContent=true` and the message type is text.",
            "type": "object"
          }
        },
        "required": [
          "deviceId",
          "id",
          "recipients",
          "state"
        ],
        "type": "object"
      },
      "smsgateway.HashedMessage": {
        "properties": {
          "hash": {
            "example": "1d4b6e3b1b6e3b1b6e3b1b6e3b1b6e3b1b6e3b1b",
            "type": "string"
          }
        },
        "required": [
          "hash"
        ],
        "type": "object"
      },
      "smsgateway.HealthCheck": {
        "properties": {
          "description": {
            "description": "A human-readable description of the check.",
            "type": "string"
          },
          "observedUnit": {
            "description": "Unit of measurement for the observed value.",
            "type": "string"
          },
          "observedValue": {
            "description": "Observed value of the check.",
            "type": "integer"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.HealthStatus"
              }
            ],
            "description": "Status of the check.\nIt can be one of the following values: \"pass\", \"warn\", or \"fail\".",
            "type": "object"
          }
        },
        "type": "object"
      },
      "smsgateway.HealthChecks": {
        "additionalProperties": {
          "$ref": "#/components/schemas/smsgateway.HealthCheck"
        },
        "type": "object"
      },
      "smsgateway.HealthResponse": {
        "properties": {
          "checks": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.HealthChecks"
              }
            ],
            "description": "A map of check names to their respective details.",
            "type": "object"
          },
          "releaseId": {
            "description": "Release ID of the application.\nIt is used to identify the version of the application.",
            "type": "integer"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.HealthStatus"
              }
            ],
            "description": "Overall status of the application.\nIt can be one of the following values: \"pass\", \"warn\", or \"fail\".",
            "type": "object"
          },
          "version": {
            "description": "Version of the application.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "smsgateway.HealthStatus": {
        "enum": [
          "pass",
          "warn",
          "fail"
        ],
        "type": "string",
        "x-enum-varnames": [
          "HealthStatusPass",
          "HealthStatusWarn",
          "HealthStatusFail"
        ]
      },
      "smsgateway.IncomingMessage": {
        "properties": {
          "contentPreview": {
            "description": "Message body preview or metadata",
            "example": "Hello World!",
            "type": "string"
          },
          "createdAt": {
            "description": "Message received timestamp",
            "example": "2020-01-01T00:00:00Z",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "description": "Incoming message ID",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "type": "string"
          },
          "recipient": {
            "description": "Recipient phone number on the device",
            "example": "+79990001234",
            "type": "string"
          },
          "sender": {
            "description": "Incoming sender phone number",
            "example": "+79990001234",
            "type": "string"
          },
          "simNumber": {
            "description": "SIM slot number",
            "example": 1,
            "type": "integer"
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.IncomingMessageType"
              }
            ],
            "description": "Message type",
            "example": "SMS",
            "type": "object"
          }
        },
        "required": [
          "contentPreview",
          "createdAt",
          "id",
          "sender",
          "type"
        ],
        "type": "object"
      },
      "smsgateway.IncomingMessageType": {
        "enum": [
          "SMS",
          "DATA_SMS",
          "MMS",
          "MMS_DOWNLOADED"
        ],
        "type": "string",
        "x-enum-comments": {
          "IncomingMessageTypeDataSMS": "Data SMS message",
          "IncomingMessageTypeMMS": "MMS message",
          "IncomingMessageTypeMmsDownloaded": "Downloaded MMS message",
          "IncomingMessageTypeSMS": "SMS message"
        },
        "x-enum-descriptions": [
          "SMS message",
          "Data SMS message",
          "MMS message",
          "Downloaded MMS message"
        ],
        "x-enum-varnames": [
          "IncomingMessageTypeSMS",
          "IncomingMessageTypeDataSMS",
          "IncomingMessageTypeMMS",
          "IncomingMessageTypeMmsDownloaded"
        ]
      },
      "smsgateway.LimitPeriod": {
        "enum": [
          "Disabled",
          "PerMinute",
          "PerHour",
          "PerDay"
        ],
        "type": "string",
        "x-enum-varnames": [
          "Disabled",
          "PerMinute",
          "PerHour",
          "PerDay"
        ]
      },
      "smsgateway.LogEntry": {
        "properties": {
          "context": {
            "additionalProperties": {
              "type": "object"
            },
            "description": "Additional context information related to the log entry, typically including data relevant to the log event.",
            "type": "object"
          },
          "createdAt": {
            "description": "The timestamp when this log entry was created.",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "description": "A unique identifier for the log entry.",
            "type": "integer"
          },
          "message": {
            "description": "A message describing the log event.",
            "type": "string"
          },
          "module": {
            "description": "The module or component of the system that generated the log entry.",
            "type": "string"
          },
          "priority": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.LogEntryPriority"
              }
            ],
            "description": "The priority level of the log entry.",
            "type": "object"
          }
        },
        "type": "object"
      },
      "smsgateway.LogEntryPriority": {
        "enum": [
          "DEBUG",
          "INFO",
          "WARN",
          "ERROR"
        ],
        "type": "string",
        "x-enum-varnames": [
          "LogEntryPriorityDebug",
          "LogEntryPriorityInfo",
          "LogEntryPriorityWarn",
          "LogEntryPriorityError"
        ]
      },
      "smsgateway.Message": {
        "properties": {
          "dataMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.DataMessage"
              }
            ],
            "description": "Data message",
            "type": "object"
          },
          "deviceId": {
            "description": "Optional device ID for explicit selection",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 21,
            "type": "string"
          },
          "id": {
            "description": "ID (if not set - will be generated)",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 36,
            "type": "string"
          },
          "isEncrypted": {
            "description": "Is encrypted",
            "example": true,
            "type": "boolean"
          },
          "message": {
            "description": "Message content (deprecated, use TextMessage instead)",
            "example": "Hello World!",
            "maxLength": 65535,
            "type": "string"
          },
          "phoneNumbers": {
            "description": "Recipients (phone numbers)",
            "example": [
              "79990001234"
            ],
            "items": {
              "type": "string"
            },
            "maxItems": 100,
            "minItems": 1,
            "type": "array"
          },
          "priority": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.MessagePriority"
              }
            ],
            "description": "Priority, messages with values greater than `99` will bypass limits and delays",
            "example": 0,
            "type": "object"
          },
          "simNumber": {
            "description": "SIM card number (1-3), if not set - default SIM will be used",
            "example": 1,
            "maximum": 3,
            "minimum": 1,
            "type": "integer"
          },
          "textMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.TextMessage"
              }
            ],
            "description": "Text message",
            "type": "object"
          },
          "ttl": {
            "description": "Time to live in seconds (conflicts with `ValidUntil`)",
            "example": 86400,
            "minimum": 5,
            "type": "integer"
          },
          "validUntil": {
            "description": "Valid until (conflicts with `TTL`)",
            "example": "2020-01-01T00:00:00Z",
            "type": "string"
          },
          "withDeliveryReport": {
            "description": "With delivery report",
            "example": true,
            "type": "boolean"
          }
        },
        "required": [
          "phoneNumbers"
        ],
        "type": "object"
      },
      "smsgateway.MessagePriority": {
        "enum": [
          -128,
          0,
          100,
          127
        ],
        "format": "int32",
        "type": "integer",
        "x-enum-comments": {
          "PriorityBypassThreshold": "Threshold at which messages bypass limits and delays"
        },
        "x-enum-descriptions": [
          "",
          "",
          "Threshold at which messages bypass limits and delays",
          ""
        ],
        "x-enum-varnames": [
          "PriorityMinimum",
          "PriorityDefault",
          "PriorityBypassThreshold",
          "PriorityMaximum"
        ]
      },
      "smsgateway.MessagesExportRequest": {
        "properties": {
          "deviceId": {
            "description": "DeviceID is the ID of the device to export messages for.",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 21,
            "type": "string"
          },
          "since": {
            "description": "Since is the start of the time range to export.",
            "example": "2024-01-01T00:00:00Z",
            "type": "string"
          },
          "until": {
            "description": "Until is the end of the time range to export.",
            "example": "2024-01-01T23:59:59Z",
            "type": "string"
          }
        },
        "required": [
          "deviceId",
          "since",
          "until"
        ],
        "type": "object"
      },
      "smsgateway.MessagesProcessingOrder": {
        "enum": [
          "LIFO",
          "FIFO"
        ],
        "type": "string",
        "x-enum-varnames": [
          "LIFO",
          "FIFO"
        ]
      },
      "smsgateway.MessageState": {
        "properties": {
          "dataMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.DataMessage"
              }
            ],
            "description": "Present only when `includeContent=true` and the message type is data.",
            "type": "object"
          },
          "deviceId": {
            "description": "Device ID",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 21,
            "type": "string"
          },
          "hashedMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.HashedMessage"
              }
            ],
            "description": "Hashed message content, if isHashed is true",
            "type": "object"
          },
          "id": {
            "description": "Message ID",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 36,
            "type": "string"
          },
          "isEncrypted": {
            "description": "Encrypted",
            "example": false,
            "type": "boolean"
          },
          "isHashed": {
            "description": "Hashed",
            "example": false,
            "type": "boolean"
          },
          "recipients": {
            "description": "Recipients states",
            "items": {
              "$ref": "#/components/schemas/smsgateway.RecipientState"
            },
            "minItems": 1,
            "type": "array"
          },
          "state": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.ProcessingState"
              }
            ],
            "description": "State",
            "example": "Pending",
            "type": "object"
          },
          "states": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "History of states",
            "type": "object"
          },
          "textMessage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.TextMessage"
              }
            ],
            "description": "Present only when `includeContent=true` and the message type is text.",
            "type": "object"
          }
        },
        "required": [
          "deviceId",
          "id",
          "recipients",
          "state"
        ],
        "type": "object"
      },
      "smsgateway.ProcessingState": {
        "enum": [
          "Pending",
          "Processed",
          "Sent",
          "Delivered",
          "Failed"
        ],
        "type": "string",
        "x-enum-comments": {
          "ProcessingStateDelivered": "Delivered",
          "ProcessingStateFailed": "Failed",
          "ProcessingStatePending": "Pending",
          "ProcessingStateProcessed": "Processed (received by device)",
          "ProcessingStateSent": "Sent"
        },
        "x-enum-descriptions": [
          "Pending",
          "Processed (received by device)",
          "Sent",
          "Delivered",
          "Failed"
        ],
        "x-enum-varnames": [
          "ProcessingStatePending",
          "ProcessingStateProcessed",
          "ProcessingStateSent",
          "ProcessingStateDelivered",
          "ProcessingStateFailed"
        ]
      },
      "smsgateway.RecipientState": {
        "properties": {
          "error": {
            "description": "Error (for `Failed` state)",
            "example": "timeout",
            "type": "string"
          },
          "phoneNumber": {
            "description": "Phone number or first 16 symbols of SHA256 hash",
            "example": "79990001234",
            "maxLength": 128,
            "minLength": 1,
            "type": "string"
          },
          "state": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.ProcessingState"
              }
            ],
            "description": "State",
            "example": "Pending",
            "type": "object"
          }
        },
        "required": [
          "phoneNumber",
          "state"
        ],
        "type": "object"
      },
      "smsgateway.SettingsEncryption": {
        "properties": {
          "passphrase": {
            "description": "Passphrase is the encryption passphrase. If nil or empty, encryption is disabled. Must not be used with Cloud Server.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "smsgateway.SettingsGateway": {
        "properties": {
          "cloud_url": {
            "description": "CloudURL is the URL of the cloud server. Must not be used with Cloud Server.",
            "type": "string"
          },
          "notification_channel": {
            "description": "NotificationChannel is the way device receives notifications.",
            "enum": [
              "AUTO",
              "SSE_ONLY"
            ],
            "type": "string"
          },
          "private_token": {
            "description": "PrivateToken is the auth token for the private server. Must not be used with Cloud Server.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "smsgateway.SettingsLogs": {
        "properties": {
          "lifetime_days": {
            "description": "LifetimeDays is the number of days to retain logs.\nMust be at least 1 when provided.",
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "smsgateway.SettingsMessages": {
        "properties": {
          "limit_period": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.LimitPeriod"
              }
            ],
            "description": "LimitPeriod defines the period for message sending limits.\nValid values are \"Disabled\", \"PerMinute\", \"PerHour\", or \"PerDay\".",
            "type": "object"
          },
          "limit_value": {
            "description": "LimitValue is the maximum number of messages allowed per limit period.\nMust be at least 1 when provided.",
            "minimum": 1,
            "type": "integer"
          },
          "log_lifetime_days": {
            "description": "LogLifetimeDays is the number of days to retain message logs.\nMust be at least 1 when provided.",
            "minimum": 1,
            "type": "integer"
          },
          "processing_order": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.MessagesProcessingOrder"
              }
            ],
            "description": "MessagesProcessingOrder defines the order in which messages are processed.\nValid values are \"LIFO\" or \"FIFO\".",
            "type": "object"
          },
          "send_interval_max": {
            "description": "SendIntervalMax is the maximum interval between message sends (in seconds).\nMust be at least 1 when provided and greater than or equal to SendIntervalMin.",
            "minimum": 1,
            "type": "integer"
          },
          "send_interval_min": {
            "description": "SendIntervalMin is the minimum interval between message sends (in seconds).\nMust be at least 1 when provided.",
            "minimum": 1,
            "type": "integer"
          },
          "sim_selection_mode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.SimSelectionMode"
              }
            ],
            "description": "SimSelectionMode defines how SIM cards are selected for sending messages.\nValid values are \"OSDefault\", \"RoundRobin\", or \"Random\".",
            "type": "object"
          }
        },
        "type": "object"
      },
      "smsgateway.SettingsPing": {
        "properties": {
          "interval_seconds": {
            "description": "IntervalSeconds is the interval between ping requests (in seconds).\nMust be at least 1 when provided.",
            "minimum": 1,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "smsgateway.SettingsWebhooks": {
        "properties": {
          "internet_required": {
            "description": "InternetRequired indicates whether internet access is required for webhooks.",
            "type": "boolean"
          },
          "retry_count": {
            "description": "RetryCount is the number of times to retry failed webhook deliveries.\nMust be at least 1 when provided.",
            "minimum": 1,
            "type": "integer"
          },
          "signing_key": {
            "description": "SigningKey is the secret key used for signing webhook payloads. Must not be used with Cloud Server.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "smsgateway.SimSelectionMode": {
        "enum": [
          "OSDefault",
          "RoundRobin",
          "Random"
        ],
        "type": "string",
        "x-enum-varnames": [
          "OSDefault",
          "RoundRobin",
          "Random"
        ]
      },
      "smsgateway.TextMessage": {
        "properties": {
          "text": {
            "description": "Text is the message text.",
            "example": "Hello World!",
            "maxLength": 65535,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "type": "object"
      },
      "smsgateway.TokenRequest": {
        "properties": {
          "scopes": {
            "description": "scopes for which the access token is valid",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "type": "array"
          },
          "ttl": {
            "description": "lifetime of the access token in seconds",
            "type": "integer"
          }
        },
        "required": [
          "scopes"
        ],
        "type": "object"
      },
      "smsgateway.TokenResponse": {
        "properties": {
          "access_token": {
            "description": "actual access token",
            "type": "string"
          },
          "expires_at": {
            "description": "time at which the access token is no longer valid",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "description": "unique identifier for the access token",
            "type": "string"
          },
          "refresh_token": {
            "description": "refresh token",
            "type": "string"
          },
          "token_type": {
            "description": "type of the access token",
            "type": "string"
          }
        },
        "type": "object"
      },
      "smsgateway.Webhook": {
        "properties": {
          "deviceId": {
            "description": "The unique identifier of the device the webhook is associated with.",
            "example": "PyDmBQZZXYmyxMwED8Fzy",
            "maxLength": 21,
            "type": "string"
          },
          "event": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.WebhookEvent"
              }
            ],
            "description": "The type of event the webhook is triggered for.",
            "example": "sms:received",
            "type": "object"
          },
          "id": {
            "description": "The unique identifier of the webhook.",
            "example": "123e4567-e89b-12d3-a456-426614174000",
            "maxLength": 36,
            "type": "string"
          },
          "url": {
            "description": "The URL the webhook will be sent to.",
            "example": "https://example.com/webhook",
            "type": "string"
          }
        },
        "required": [
          "event",
          "url"
        ],
        "type": "object"
      },
      "smsgateway.WebhookEvent": {
        "enum": [
          "sms:received",
          "sms:data-received",
          "sms:sent",
          "sms:delivered",
          "sms:failed",
          "system:ping",
          "mms:received",
          "mms:downloaded"
        ],
        "type": "string",
        "x-enum-comments": {
          "WebhookEventMmsDownloaded": "Triggered when an MMS is downloaded.",
          "WebhookEventMmsReceived": "Triggered when an MMS is received.",
          "WebhookEventSmsDataReceived": "Triggered when a data SMS is received.",
          "WebhookEventSmsDelivered": "Triggered when an SMS is delivered.",
          "WebhookEventSmsFailed": "Triggered when an SMS processing fails.",
          "WebhookEventSmsReceived": "Triggered when an SMS is received.",
          "WebhookEventSmsSent": "Triggered when an SMS is sent.",
          "WebhookEventSystemPing": "Triggered when the device pings the server."
        },
        "x-enum-descriptions": [
          "Triggered when an SMS is received.",
          "Triggered when a data SMS is received.",
          "Triggered when an SMS is sent.",
          "Triggered when an SMS is delivered.",
          "Triggered when an SMS processing fails.",
          "Triggered when the device pings the server.",
          "Triggered when an MMS is received.",
          "Triggered when an MMS is downloaded."
        ],
        "x-enum-varnames": [
          "WebhookEventSmsReceived",
          "WebhookEventSmsDataReceived",
          "WebhookEventSmsSent",
          "WebhookEventSmsDelivered",
          "WebhookEventSmsFailed",
          "WebhookEventSystemPing",
          "WebhookEventMmsReceived",
          "WebhookEventMmsDownloaded"
        ]
      },
      "SmsReceivedPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SmsEventPayload"
          },
          {
            "properties": {
              "message": {
                "description": "The content of the SMS message received.",
                "type": "string"
              },
              "receivedAt": {
                "description": "The timestamp when the SMS message was received.",
                "format": "date-time",
                "type": "string"
              }
            },
            "type": "object"
          }
        ],
        "description": "Payload of `sms:received` event.",
        "title": "SmsReceivedPayload"
      },
      "SmsSentPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SmsEventPayload"
          },
          {
            "properties": {
              "sentAt": {
                "description": "The timestamp when the SMS message was sent.",
                "format": "date-time",
                "type": "string"
              }
            },
            "type": "object"
          }
        ],
        "description": "Payload of `sms:sent` event.",
        "title": "SmsSentPayload"
      },
      "SystemPingPayload": {
        "description": "Payload of `system:ping` event.",
        "title": "SystemPingPayload",
        "type": "object"
      },
      "WebHookEvent": {
        "properties": {
          "deviceId": {
            "description": "The unique identifier of the device.",
            "type": "string"
          },
          "event": {
            "allOf": [
              {
                "$ref": "#/components/schemas/smsgateway.WebhookEvent"
              }
            ],
            "description": "The type of event that triggered the webhook.",
            "type": "string"
          },
          "id": {
            "description": "The unique identifier of the webhook event.",
            "type": "string"
          },
          "payload": {
            "description": "The data associated with the event.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/SmsReceivedPayload"
              },
              {
                "$ref": "#/components/schemas/SmsSentPayload"
              },
              {
                "$ref": "#/components/schemas/SmsDeliveredPayload"
              },
              {
                "$ref": "#/components/schemas/SmsFailedPayload"
              },
              {
                "$ref": "#/components/schemas/SystemPingPayload"
              },
              {
                "$ref": "#/components/schemas/SmsDataReceivedPayload"
              },
              {
                "$ref": "#/components/schemas/MmsReceivedPayload"
              },
              {
                "$ref": "#/components/schemas/MmsDownloadedPayload"
              }
            ]
          },
          "webhookId": {
            "description": "The identifier of the webhook configuration that triggered this event.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "webhookId",
          "deviceId",
          "event",
          "payload"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "ApiAuth": {
        "scheme": "basic",
        "type": "http"
      },
      "JWTAuth": {
        "description": "JWT authentication",
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      },
      "MobileToken": {
        "description": "Mobile device token",
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      },
      "ServerKey": {
        "description": "Private server authentication",
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      },
      "UserCode": {
        "description": "User one-time code authentication",
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "contact": {
      "email": "support@sms-gate.app",
      "name": "SMSGate Support",
      "url": "https://docs.sms-gate.app/"
    },
    "description": "This API provides programmatic access to sending SMS messages on Android devices. Features include sending SMS, checking message status, device management, webhook configuration, and system health checks.",
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0"
    },
    "title": "SMSGate API",
    "version": "{{VERSION}}"
  },
  "openapi": "3.0.1",
  "paths": {
    "/auth/token": {
      "post": {
        "description": "Generate new access token with specified scopes and ttl",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/smsgateway.TokenRequest"
              }
            }
          },
          "description": "Request",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.TokenResponse"
                }
              }
            },
            "description": "Token"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          },
          "501": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Not implemented"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Generate token",
        "tags": [
          "User",
          "Auth"
        ],
        "x-codegen-request-body-name": "request"
      }
    },
    "/auth/token/{jti}": {
      "delete": {
        "description": "Revoke access token with specified jti",
        "parameters": [
          {
            "description": "JWT ID",
            "in": "path",
            "name": "jti",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "content": {},
            "description": "No Content"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          },
          "501": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Not implemented"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Revoke token",
        "tags": [
          "User",
          "Auth"
        ]
      }
    },
    "/auth/token/refresh": {
      "post": {
        "description": "Refresh access token with specified refresh token",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.TokenResponse"
                }
              }
            },
            "description": "Token"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          },
          "501": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Not implemented"
          }
        },
        "security": [
          {
            "JWTAuth": []
          }
        ],
        "summary": "Refresh token",
        "tags": [
          "User",
          "Auth"
        ]
      }
    },
    "/devices": {
      "get": {
        "description": "Returns list of registered devices",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/smsgateway.Device"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Device list"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "List devices",
        "tags": [
          "User",
          "Devices"
        ]
      }
    },
    "/devices/{id}": {
      "delete": {
        "description": "Removes device",
        "parameters": [
          {
            "description": "Device ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "content": {},
            "description": "Successfully removed"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Device not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Remove device",
        "tags": [
          "User",
          "Devices"
        ]
      }
    },
    "/health": {
      "get": {
        "description": "Checks if service is ready to serve traffic (readiness probe)",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service is ready"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service is not ready"
          }
        },
        "security": [],
        "summary": "Readiness probe",
        "tags": [
          "System"
        ]
      }
    },
    "/health/live": {
      "get": {
        "description": "Checks if service is running (liveness probe)",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service is alive"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service is not alive"
          }
        },
        "security": [],
        "summary": "Liveness probe",
        "tags": [
          "System"
        ]
      }
    },
    "/health/ready": {
      "get": {
        "description": "Checks if service is ready to serve traffic (readiness probe)",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service is ready"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service is not ready"
          }
        },
        "security": [],
        "summary": "Readiness probe",
        "tags": [
          "System"
        ]
      }
    },
    "/health/startup": {
      "get": {
        "description": "Checks if service has completed initialization (startup probe)",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service has completed initialization"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.HealthResponse"
                }
              }
            },
            "description": "Service has not completed initialization"
          }
        },
        "security": [],
        "summary": "Startup probe",
        "tags": [
          "System"
        ]
      }
    },
    "/inbox": {
      "get": {
        "description": "Retrieves incoming messages with filtering and pagination.",
        "parameters": [
          {
            "description": "Filter incoming messages by type",
            "in": "query",
            "name": "type",
            "schema": {
              "enum": [
                "SMS",
                "DATA_SMS",
                "MMS",
                "MMS_DOWNLOADED"
              ],
              "type": "string"
            }
          },
          {
            "description": "Maximum number of messages to return",
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "maximum": 500,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Number of messages to skip",
            "in": "query",
            "name": "offset",
            "schema": {
              "default": 0,
              "minimum": 0,
              "type": "integer"
            }
          },
          {
            "description": "Start of date range (ISO 8601)",
            "in": "query",
            "name": "from",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "End of date range (ISO 8601)",
            "in": "query",
            "name": "to",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Device ID",
            "in": "query",
            "name": "deviceId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/smsgateway.IncomingMessage"
                  },
                  "type": "array"
                }
              }
            },
            "description": "A list of incoming messages",
            "headers": {
              "X-Total-Count": {
                "description": "Total number of items available",
                "schema": {
                  "format": "int64",
                  "type": "integer"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          },
          "501": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Not implemented"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Get incoming messages",
        "tags": [
          "User",
          "Inbox"
        ]
      }
    },
    "/inbox/refresh": {
      "post": {
        "description": "Refreshes inbox messages. Webhooks will not be triggered.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/smsgateway.MessagesExportRequest"
              }
            }
          },
          "description": "Export inbox request",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Inbox refresh request accepted"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          },
          "501": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Not implemented"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Request inbox messages refresh",
        "tags": [
          "User",
          "Inbox"
        ],
        "x-codegen-request-body-name": "request"
      }
    },
    "/logs": {
      "get": {
        "description": "Retrieve a list of log entries within a specified time range.",
        "parameters": [
          {
            "description": "The start of the time range for the logs to retrieve. Logs created after this timestamp will be included.",
            "in": "query",
            "name": "from",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "The end of the time range for the logs to retrieve. Logs created before this timestamp will be included.",
            "in": "query",
            "name": "to",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/smsgateway.LogEntry"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Log entries"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          },
          "501": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Not implemented"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Get logs",
        "tags": [
          "System",
          "Logs"
        ]
      }
    },
    "/messages": {
      "get": {
        "description": "Retrieves a list of messages with filtering and pagination",
        "parameters": [
          {
            "description": "Start date in RFC3339 format",
            "in": "query",
            "name": "from",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "End date in RFC3339 format",
            "in": "query",
            "name": "to",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter messages by processing state",
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by device ID",
            "in": "query",
            "name": "deviceId",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Pagination limit",
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer"
            }
          },
          {
            "description": "Pagination offset",
            "in": "query",
            "name": "offset",
            "schema": {
              "default": 0,
              "type": "integer"
            }
          },
          {
            "description": "Include textMessage/dataMessage content for each message. Default is false",
            "in": "query",
            "name": "includeContent",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/smsgateway.MessageState"
                  },
                  "type": "array"
                }
              }
            },
            "description": "A list of messages"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Get messages",
        "tags": [
          "User",
          "Messages"
        ]
      },
      "post": {
        "description": "Enqueues a message for sending. If `deviceId` is set, the specified device is used; otherwise a random registered device is chosen.",
        "parameters": [
          {
            "description": "Skip phone validation",
            "in": "query",
            "name": "skipPhoneValidation",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "Filter devices active within the specified number of hours",
            "in": "query",
            "name": "deviceActiveWithin",
            "schema": {
              "default": 0,
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/smsgateway.Message"
              }
            }
          },
          "description": "Send message request",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.GetMessageResponse"
                }
              }
            },
            "description": "Message enqueued",
            "headers": {
              "Location": {
                "description": "Get message state URL",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Message with such ID already exists"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Enqueue message",
        "tags": [
          "User",
          "Messages"
        ],
        "x-codegen-request-body-name": "request"
      }
    },
    "/messages/{id}": {
      "get": {
        "description": "Returns message state by ID",
        "parameters": [
          {
            "description": "Message ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.GetMessageResponse"
                }
              }
            },
            "description": "Message state"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Get message state",
        "tags": [
          "User",
          "Messages"
        ]
      }
    },
    "/messages/inbox/export": {
      "post": {
        "description": "Initiates process of inbox messages export via webhooks. For each message the `sms:received` webhook will be triggered. The webhooks will be triggered without specific order.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/smsgateway.MessagesExportRequest"
              }
            }
          },
          "description": "Export inbox request",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Inbox export request accepted"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Request inbox messages export",
        "tags": [
          "User",
          "Messages"
        ],
        "x-codegen-request-body-name": "request"
      }
    },
    "/settings": {
      "get": {
        "description": "Returns settings for a specific user",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.DeviceSettings"
                }
              }
            },
            "description": "Settings"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Get settings",
        "tags": [
          "User",
          "Settings"
        ]
      },
      "patch": {
        "description": "Partially updates settings for a specific user",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/smsgateway.DeviceSettings"
              }
            }
          },
          "description": "Settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Settings updated"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Partially update settings",
        "tags": [
          "User",
          "Settings"
        ],
        "x-codegen-request-body-name": "request"
      },
      "put": {
        "description": "Replaces settings",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/smsgateway.DeviceSettings"
              }
            }
          },
          "description": "Settings",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Settings updated"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Replace settings",
        "tags": [
          "User",
          "Settings"
        ],
        "x-codegen-request-body-name": "request"
      }
    },
    "/webhooks": {
      "get": {
        "description": "Returns list of registered webhooks",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/smsgateway.Webhook"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Webhook list"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "List webhooks",
        "tags": [
          "User",
          "Webhooks"
        ]
      },
      "post": {
        "callbacks": {
          "onEvent": {
            "{$request.body#/url}": {
              "post": {
                "requestBody": {
                  "content": {
                    "application/json": {
                      "schema": {
                        "$ref": "#/components/schemas/WebHookEvent"
                      }
                    }
                  },
                  "description": "Event details.",
                  "required": true
                },
                "responses": {
                  "200": {
                    "description": "The server should return this HTTP status code if the data was received successfully."
                  }
                }
              }
            }
          }
        },
        "description": "Registers webhook. If webhook with same ID already exists, it will be replaced",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/smsgateway.Webhook"
              }
            }
          },
          "description": "Webhook",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.Webhook"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Register webhook",
        "tags": [
          "User",
          "Webhooks"
        ],
        "x-codegen-request-body-name": "request"
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "description": "Deletes webhook",
        "parameters": [
          {
            "description": "Webhook ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successfully removed"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Forbidden"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/smsgateway.ErrorResponse"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "ApiAuth": []
          },
          {
            "JWTAuth": []
          }
        ],
        "summary": "Delete webhook",
        "tags": [
          "User",
          "Webhooks"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "Local Server",
      "url": "/"
    },
    {
      "description": "Cloud Server",
      "url": "https://api.sms-gate.app/3rdparty/v1"
    }
  ],
  "tags": [
    {
      "name": "Auth"
    },
    {
      "name": "Devices"
    },
    {
      "name": "Logs"
    },
    {
      "name": "Messages"
    },
    {
      "name": "Settings"
    },
    {
      "name": "System"
    },
    {
      "name": "User"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Inbox"
    }
  ]
}