# Where things live

An entity's file holds only its data definition: its store, fields,
unique rules, indexes, lifecycle, policy and record cache. Every entity
gets generated operations: `Todo.get`, create, update and delete.

Everything else has a folder of its own in the domain, one declaration per
file: every query you write in `queries/`, every action in `actions/` and
every failure in `failures/`.

```jadpo
// domains/planning/failures/todo_not_found.jadpo
type TodoNotFound = Failure {
    kind: FailureKind.not_found
    message: "Todo not found."
}

// domains/planning/actions/complete_todo.jadpo
action complete_todo(todo_id: Todo.id) fails TodoNotFound -> Todo {
    var todo: Todo = attempt Todo.get(todo_id)
    ...
}
```

`Todo.get(todo_id)` above is one of the generated operations. A written
action is called by its name, `complete_todo(todo_id)`, or
`planning.complete_todo(todo_id)` from another domain when it is public.

There is no `self`. A parameter `todo: Todo` is a snapshot of the record,
and `todo_id: Todo.id` is a reference to it.
