DeclareModule Database
	; Public Constants
	#SESSION_DURATION = 86400	; 24 hours
	
	; Public procedure declarations
	Declare.i Init(Path.s)
	Declare   Close()
	Declare.i UserCount()
	Declare.i FindUser(Username.s)
	Declare.i CreateUser(Username.s, Password.s)
	Declare ChangePassword(UserID.i, NewPassword.s)
	Declare.s ValidateCredentials(Username.s, Password.s)
	Declare.s CreateSession(UserID.i, Username.s)
	Declare.s ValidateSession(Token.s)
	Declare   DeleteSession(Token.s)
	Declare   CleanExpiredSessions()
	
	Declare.i FSInit()
	Declare.i FSGetOrCreateHome(UserID.i)
	Declare.i FSResolve(UserID.i, Path.s)
	Declare.s FSList(NodeID.i)
	Declare.s FSStat(NodeID.i)
	Declare.i FSGetOwner(NodeID.i, *IsDir.Integer = 0)
	Declare.i FSMkdir(UserID.i, ParentID.i, Name.s)
	Declare.i FSCreateFile(UserID.i, ParentID.i, Name.s, MimeType.s)
	Declare   FSUpdateFile(NodeID.i, Size.i)
	Declare   FSDelete(NodeID.i)
	Declare   FSMove(NodeID.i, NewParentID.i, NewName.s)
	
	Declare.i AppInstall(UserID.i, AppID.s, Manifest.s, Permissions.s)
	Declare   AppUninstall(UserID.i, AppID.s)
	Declare.i AppExists(UserID.i, AppID.s)
	Declare.s AppGetPermissions(UserID.i, AppID.s)
	Declare.s AppList(UserID.i)
EndDeclareModule

DeclareModule General
	; Public procedure declarations
	Declare RespondJSON(*Request, JSON.s, Status.s = "200 OK")
	Declare ServeStatic(*Request, URI.s)
	Declare.s GetPostField(*Request, Field.s)
	Declare.s GetQueryField(*Request, Field.s)
EndDeclareModule

DeclareModule Auth
	; Public Constants
	#SESSION_COOKIE  = "kumos_session"
	#SESSION_MAX_AGE = "86400"
	
	; Public procedure declarations
	Declare   HandleLogin(*Request)
	Declare   HandleLogout(*Request)
	Declare   HandleCheck(*Request)
	Declare.s GetSessionUser(*Request)
	Declare HandleChangePassword(*Request)
EndDeclareModule

DeclareModule Router
	; Public procedure declarations
	Declare Route(*Request)
EndDeclareModule

DeclareModule FileSystem
	; Public procedure declarations
	Declare HandleList(*Request)
	Declare HandleStat(*Request)
	Declare HandleRead(*Request)
	Declare HandleWrite(*Request)
	Declare HandleMkdir(*Request)
	Declare HandleDelete(*Request)
	Declare HandleMove(*Request)
EndDeclareModule

DeclareModule AppStore
	; Public procedure declarations
	Declare Init()
	Declare HandleList(*Request)
	Declare HandleInstall(*Request)
	Declare HandleUninstall(*Request)
	Declare HandleServeFile(*Request, AppID.s, FilePath.s)
EndDeclareModule
; IDE Options = PureBasic 6.30 (Windows - x64)
; CursorPosition = 23
; FirstLine = 4
; Folding = --
; EnableXP
; DPIAware