syntax = "v1"

info (
	title:   "Tools Api"
	desc:    "API for ppanel"
	author:  "Tension"
	email:   "tension@ppanel.com"
	version: "0.0.1"
)

import "../types.api"

type (
	LogResponse {
		List interface{} `json:"list"`
	}
	VersionResponse {
		Version string `json:"version"`
	}
	QueryIPLocationRequest {
		IP string `form:"ip" validate:"required"`
	}
	QueryIPLocationResponse {
		Country string `json:"country"`
		Region  string `json:"region,omitempty"`
		City    string `json:"city"`
	}
)

@server (
	prefix:     v1/admin/tool
	group:      admin/tool
	middleware: AuthMiddleware
)
service ppanel {
	@doc "Get System Log"
	@handler GetSystemLog
	get /log returns (LogResponse)

	@doc "Restart System"
	@handler RestartSystem
	get /restart

	@doc "Get Version"
	@handler GetVersion
	get /version returns (VersionResponse)

	@doc "Query IP Location"
	@handler QueryIPLocation
	get /ip/location (QueryIPLocationRequest) returns (QueryIPLocationResponse)
}

