# Written by `tilo-app surface`; review changes like an API change.

[[resources]]
kind = "snippets.library"
label = "Snippets"
version = 1
fields = [
  { path = "snippets", type = "Collection<Snippet>", stored = "collection" },
  { path = "snippets.*.title", type = "String", label = true },
  { path = "snippets.*.body", type = "String" },
  { path = "snippets.*.description", type = "String" },
  { path = "snippets.*.favorite", type = "bool" },
  { path = "snippets.*.folder", type = "Atom" },
  { path = "snippets.*.language", type = "Language" },
  { path = "snippets.*.tags", type = "Set<String>" },
  { path = "snippets.*.uses", type = "Counter", readonly = true },
]

[[resources.verbs]]
id = "new-snippet"
kind = "undoable"
params = [
  { name = "title", required = true, schema = { type = "string" } },
  { name = "folder", required = false, schema = { type = ["string", "null"] } },
]

[[resources.verbs]]
id = "duplicate"
kind = "undoable"
params = [
  { name = "snippet", required = true, schema = { type = "string" } },
  { name = "title", required = false, schema = { type = ["string", "null"] } },
]

[[resources.verbs]]
id = "delete"
destructive = true
kind = "undoable"
params = [
  { name = "snippet", required = true, schema = { type = "string" } },
]

[[resources.verbs]]
id = "record-use"
kind = "undoable"
params = [
  { name = "snippet", required = true, schema = { type = "string" } },
]

[[resources.verbs]]
id = "rename-folder"
kind = "undoable"
params = [
  { name = "folder", required = true, schema = { type = "string" } },
  { name = "to", required = true, schema = { type = "string" } },
]

[[resources.verbs]]
id = "rename-tag"
kind = "undoable"
params = [
  { name = "tag", required = true, schema = { type = "string" } },
  { name = "to", required = true, schema = { type = "string" } },
]

[[resources.verbs]]
id = "remove-tag"
kind = "undoable"
params = [
  { name = "tag", required = true, schema = { type = "string" } },
]

