{
	"openapi": "3.0.0",
	"info": {
		"title": "Api.TTSCloud",
		"description": "TTSCloud Api",
		"version": "1.0.0",
		"contact": {
			"email": "ttsdesign@gmail.com"
		},
		"license": {
			"name": "Apache 2.0",
			"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
		}
	},
	"servers": [
		{
			"url": "http://api.ttscloud.net"
		}
	],
	"paths": {
		"/login": {
			"get": {
				"tags": [
					"Auth"
				],
				"responses": {
					"200": {
						"description": "Login form",
						"content": {
							"text/html": {
								"schema": {
									"type": "string"
								}
							}
						}
					}
				}
			},
			"post": {
				"tags": [
					"Auth"
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/x-www-form-urlencoded": {
							"schema": {
								"$ref": "#/components/schemas/LoginCredentials"
							}
						},
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/LoginCredentials"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Success",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"properties": {
										"status": {
											"type": "string"
										}
									}
								}
							}
						}
					},
					"302": {
						"description": "Login Redirect"
					},
					"401": {
						"description": "Unauthorized"
					}
				}
			}
		},
		"/logout": {
			"get": {
				"description": "Logout",
				"tags": [
					"Auth"
				],
				"responses": {
					"302": {
						"description": "Logout Redirect"
					}
				}
			}
		},
		"/whoami": {
			"get": {
				"description": "Get effective user details",
				"tags": [
					"Auth"
				],
				"responses": {
					"200": {
						"description": "User details",
						"content": {
							"application/json": {
								"schema": {
									"type": "object",
									"required": [
										"id",
										"username",
										"name"
									],
									"properties": {
										"id": {
											"type": "integer"
										},
										"username": {
											"type": "string"
										},
										"name": {
											"type": "object",
											"properties": {
												"first": {
													"type": "string"
												},
												"last": {
													"type": "string"
												}
											}
										}
									},
									"description": "User details"
								}
							},
							"text/html": {
								"schema": {
									"type": "string",
									"description": "User card html"
								}
							}
						}
					}
				}
			}
		},
		"/docs": {
			"get": {
				"description": "Api Docs",
				"tags": [
					"Docs"
				],
				"responses": {
					"200": {
						"content": {
							"text/html": {
								"schema": {
									"format": "html",
									"description": "",
									"pattern": "",
									"type": "string",
									"externalDocs": {
										"description": "",
										"url": ""
									},
									"example": "",
									"encoding": ""
								}
							}
						}
					}
				}
			}
		},
		"/specs/spec": {
			"get": {
				"description": "OpenApi Specs",
				"tags": [
					"Specs"
				],
				"responses": {
					"200": {
						"content": {
							"text/html": {
								"schema": {
									"type": "string"
								}
							}
						}
					}
				}
			}
		},
		"/db/{server}/dbs": {
			"get": {
				"description": "Get databases list",
				"tags": [
					"Db::Databases"
				],
				"responses": {
					"200": {
						"description": "na",
						"content": {
							"application/json": {
								"schema": {
									"type": "object"
								}
							},
							"text/html": {
								"schema": {
									"type": "string",
									"format": "html"
								}
							}
						}
					}
				},
				"parameters": [
					{
						"$ref": "#/parameters/server",
						"name": "server"
					},
					{
						"$ref": "#/parameters/format",
						"name": "format"
					}
				]
			},
			"put": {
				"description": "Add a database",
				"tags": [
					"Db::Databases"
				],
				"responses": {
					"200": {
						"description": "na",
						"content": {
							"application/json": {
								"schema": {
									"type": "object"
								}
							},
							"text/html": {
								"schema": {
									"type": "string",
									"format": "html"
								}
							}
						}
					}
				},
				"parameters": [
					{
						"$ref": "#/parameters/server",
						"name": "server"
					}
				]
			},
			"parameters": [
				{
					"$ref": "#/components/parameters/server"
				},
				{
					"$ref": "#/components/parameters/format"
				}
			]
		},
		"/db/{server}/db/{db}": {
			"get": {
				"description": "Get database general info & stats",
				"tags": [
					"Db::Databases"
				]
			},
			"post": {
				"description": "Alter a database",
				"tags": [
					"Db::Databases",
					"Roadmap"
				]
			},
			"delete": {
				"description": "Delete database",
				"tags": [
					"Db::Databases"
				]
			}
		},
		"/db/{server}/db/{db}/export": {
			"get": {
				"description": "Export database",
				"tags": [
					"Db::Databases",
					"Roadmap"
				]
			}
		},
		"/db/{server}/db/{db}/schema": {
			"get": {
				"description": "Get database schema",
				"tags": [
					"Db::Databases"
				]
			}
		},
		"/db/{server}/db/{db}/tables": {
			"get": {
				"description": "Get tables list",
				"tags": [
					"Db::Tables"
				]
			},
			"put": {
				"description": "Add a table",
				"tags": [
					"Db::Tables"
				]
			}
		},
		"/db/{server}/db/{db}/table/:table": {
			"get": {
				"description": "Get table general info & stats",
				"tags": [
					"Db::Tables"
				]
			},
			"post": {
				"description": "Alter a table",
				"tags": [
					"Db::Tables",
					"Roadmap"
				]
			},
			"delete": {
				"description": "Delete a table",
				"tags": [
					"Db::Tables"
				]
			}
		},
		"/db/{server}/db/{db}/table/:table/export": {
			"get": {
				"description": "Export table",
				"tags": [
					"Db::Tables",
					"Roadmap"
				]
			}
		},
		"/db/{server}/db/{db}/table/:table/schema": {
			"get": {
				"description": "Get table schema",
				"tags": [
					"Db::Tables"
				]
			}
		},
		"/db/{server}/db/{db}/table/:table/records": {
			"get": {
				"description": "Get records list",
				"tags": [
					"Db::Records"
				]
			},
			"put": {
				"description": "Add a record",
				"tags": [
					"Db::Records"
				]
			}
		},
		"/db/{server}/db/{db}/table/:table/record/:id": {
			"get": {
				"description": "Get record",
				"tags": [
					"Db::Records"
				]
			},
			"post": {
				"description": "Update a record",
				"tags": [
					"Db::Records"
				]
			},
			"delete": {
				"descriptions": "Delete a record",
				"tags": [
					"Db::Records"
				]
			}
		},
		"/specs": {
			"get": {
				"description": "OpenApi Specs",
				"tags": [
					"Docs"
				],
				"parameters": [
					{
						"name": "accept",
						"in": "header",
						"required": true,
						"deprecated": false,
						"schema": {
							"type": "string",
							"enum": [
								"application/json",
								"text/html"
							],
							"format": "mime-type"
						}
					}
				],
				"responses": {
					"200": {
						"content": {
							"text/html": {
								"schema": {
									"format": "html",
									"description": "",
									"pattern": "",
									"type": "string",
									"externalDocs": {
										"description": "",
										"url": ""
									},
									"enum": null,
									"example": "",
									"encoding": ""
								}
							},
							"application/json": {
								"schema": {
									"type": "object",
									"enum": null,
									"description": "",
									"example": "",
									"externalDocs": {
										"url": "",
										"description": ""
									},
									"properties": ""
								},
								"encoding": ""
							}
						}
					}
				}
			}
		}
	},
	"parameters": {
		"server": {
			"name": "server",
			"description": "database server type",
			"in": "path",
			"required": true,
			"schema": {
				"type": "string",
				"enum": [
					"mysql",
					"maria"
				]
			},
			"deprecated": false,
			"example": "mysql"
		},
		"format": {
			"name": "format",
			"description": "response format",
			"in": "query",
			"required": false,
			"schema": {
				"type": "string",
				"enum": [
					"html",
					"json"
				]
			},
			"example": "json"
		}
	},
	"components": {
		"schemas": {
			"LoginCredentials": {
				"type": "object",
				"properties": {
					"username": {
						"type": "string"
					},
					"password": {
						"type": "string",
						"format": "password"
					}
				}
			}
		},
		"parameters": {
			"server": {
				"name": "server",
				"description": "database server type",
				"in": "path",
				"required": true,
				"schema": {
					"type": "string",
					"enum": [
						"mysql",
						"maria"
					]
				},
				"deprecated": false,
				"example": "mysql"
			},
			"format": {
				"name": "format",
				"description": "response format",
				"in": "query",
				"required": false,
				"schema": {
					"type": "string",
					"enum": [
						"html",
						"json"
					]
				},
				"example": "json"
			}
		}
	},
	"tags": []
}