trait = "is-daemon"
doc = "Core trait common to all yaq daemons."
requires = []

[config]

[config.port]
doc = "TCP port for daemon to occupy."
type = "int"

[config.serial]
doc = "Serial number for the particular device represented by the daemon"
type = ["null", "string"]
default = "__null__"

[config.make]
type = ["null", "string"]
default = "__null__"

[config.model]
type = ["null", "string"]
default = "__null__"

[config.enable]
doc = "Disable this daemon. The kind entry-point will not attempt to start this daemon."
type = "boolean"
default = true

[config.log_level]
doc = "Set daemon log-level."
type = {type="enum", name="level", symbols=["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]}
default = "info"

[config.log_to_file]
doc = "Optionally force logging to a file."
type = "boolean"
default = false

[messages]

[messages.busy]
doc = "Returns true if daemon is currently busy."
response = "boolean"

[messages.id]
doc = """
JSON object with information to identify the daemon, including name, kind, make, model, serial.
"""
response = {type="map", "values"=["null", "string"]}

[messages.get_config_filepath]
doc = """
String representing the absolute filepath of the configuration file on the host machine.
"""
response = "string"

[messages.get_config]
doc = """
Full configuration for the individual daemon as defined in the TOML file.
This includes defaults and shared settings not directly specified in the daemon-specific TOML table.
"""
response = "string"

[messages.shutdown]
doc = "Cleanly shutdown (or restart) daemon."
request = [
  {"name"="restart", "type"="boolean", "default"=false},
]

[messages.get_state]
doc = "Get version of the running daemon"
response = "string"
