-record(age_web_request, {
method :: string(),
headers = [] :: list(age_web_header()),
params = [] :: list(age_web_param()),
body :: binary(),
query :: string(),
query_path :: string(),
app_path :: string(),
root_path :: string(),
client_ip :: age_net_address(),
client_port :: age_net_port(),
server_port :: age_net_port(),
server_name = "localhost" :: string(),
server_type :: atom(),
server_socket :: port(),
server_settings = [] :: list(age_web_header())
}).
-record(age_web_response, {
type = html :: age_web_response_type(),
headers = [] :: list(age_web_header()),
params = [] :: list(age_web_param()),
content = "" :: age_web_response_content(),
path = "" :: string(),
status = ?AGE_WEB_STATUS_OK :: integer(),
server_type :: atom(),
server_socket :: port()
}).
-type age_web_header() :: {atom(), any()}.
-type age_web_param() :: {atom(), string()}.
-type age_web_response_type() :: html | template | json | base64 | text | redirect | forward.
-type age_web_response_content() :: string() | tuple() | list() | atom().
-record(age_web_app, {
controller = ?MODULE :: atom(),
version = #{major => 1, minor => 0, release => 0, build => 0} :: map(),
state = enabled :: enabled | disabled,
title :: string(),
models = [] :: list(atom()),
context = [] :: list(atom()),
templates = [] :: list(atom())
}).
-type age_web_lang_field() :: {string(), list({atom(), string()})}.
-record(age_web_lang, {
controller :: atom() | string(),
fields = [] :: list(age_web_lang_field())
}).
-type age_web_item_type() :: cookie.
-type age_web_item() :: {{age_web_item_type(), string()}, map()}.
-record(age_web_port, {
socket :: port(),
life = ?AGE_WEB_PORT_LIFE :: integer(),
stamp = {0, 0, 0} :: age_time_stamp(),
items = [] :: list(age_web_item())
}).
-record(age_web_session, {
sid :: any(),
life = 1800 :: integer(), % Session life in seconds
stamp = {0, 0, 0} :: age_time_stamp(), % Time stamp when the session has been updated
params = [] :: list(age_web_param()),
data = undefined :: any()
}).
-record(age_web_api, {
controller = ?MODULE :: atom(),
state = enabled :: enabled | disabled,
templates = [] :: list(atom())
}).
-record(age_web_form, {
controller = ?MODULE :: atom(),
groups = [] :: list(age_web_form_group())
}).
-type age_web_form_group() :: tuple().
-record(age_web_form_group, {
id :: integer(),
title = "" :: string(),
column = 0 :: integer(),
hidden = false :: boolean(),
color :: string(),
fields = [] :: list(age_web_form_field())
}).
-type age_web_form_field() :: tuple().
-record(age_web_form_field, {
id :: atom(),
type :: atom(),
title = "" :: string(),
required = false :: boolean(),
hidden = false :: boolean(),
readonly = false :: boolean(),
clickable = false :: boolean(),
settings = [] :: list(),
style = [] :: list(),
attributes = [] :: list(),
headerAttributes = [] :: list()
}).
|