## Documentation index

This index lists every available documentation page and its Markdown source.

- [About VDL](https://vdl.varavel.com/docs/about/index.md)
- [Guides](https://vdl.varavel.com/docs/guides/index.md)
  - [Installation](https://vdl.varavel.com/docs/guides/installation/index.md)
  - [CLI Commands](https://vdl.varavel.com/docs/guides/cli/index.md)
  - [Editor Integration](https://vdl.varavel.com/docs/guides/editors/index.md)
  - [Project Configuration](https://vdl.varavel.com/docs/guides/configuration/index.md)
  - [Creating Plugins](https://vdl.varavel.com/docs/guides/creating-plugins/index.md)
- [Language](https://vdl.varavel.com/docs/language/index.md)
  - [Start Here](https://vdl.varavel.com/docs/language/start-here/index.md)
  - [Files and Comments](https://vdl.varavel.com/docs/language/files/index.md)
  - [Includes](https://vdl.varavel.com/docs/language/includes/index.md)
  - [Docstrings](https://vdl.varavel.com/docs/language/docstrings/index.md)
  - [Types](https://vdl.varavel.com/docs/language/types/index.md)
  - [Field Types](https://vdl.varavel.com/docs/language/field-types/index.md)
  - [Enums](https://vdl.varavel.com/docs/language/enums/index.md)
  - [Constants and Literals](https://vdl.varavel.com/docs/language/constants/index.md)
  - [Annotations](https://vdl.varavel.com/docs/language/annotations/index.md)
  - [Spreads and References](https://vdl.varavel.com/docs/language/spreads-references/index.md)
  - [Naming and Validation](https://vdl.varavel.com/docs/language/naming-validation/index.md)
- [VDL Plugin Protocols](https://vdl.varavel.com/docs/protocols/index.md)
  - [Introduction](https://vdl.varavel.com/docs/protocols/introduction/index.md)
  - [VPP-0: Core](https://vdl.varavel.com/docs/protocols/core/index.md)
  - [VPP-1: Deprecations](https://vdl.varavel.com/docs/protocols/deprecations/index.md)
  - [VPP-2: HTTP-RPC](https://vdl.varavel.com/docs/protocols/http-rpc/index.md)
  - [VPP-3: Policy](https://vdl.varavel.com/docs/protocols/policy/index.md)
  - [VPP-4: Events](https://vdl.varavel.com/docs/protocols/events/index.md)
- [Reference](https://vdl.varavel.com/docs/reference/index.md)
  - [Language Specification](https://vdl.varavel.com/docs/reference/spec/index.md)
  - [Formatting Guide](https://vdl.varavel.com/docs/reference/formatting-guide/index.md)


## Documentation content

The documentation for the current page follows, reproduced verbatim.


## What Enums Are

Enums define a named set of possible values.

```vdl
enum OrderStatus {
  Pending
  Paid
  Shipped
}
```

Use enums when a field should accept only one value from a known list.

```vdl
type Order {
  id string
  status OrderStatus
}
```

## Implicit String Values

When a member has no explicit value, its value is the member name.

```vdl
enum Status {
  Active
  Disabled
}
```

This is equivalent to:

```vdl
enum Status {
  Active = "Active"
  Disabled = "Disabled"
}
```

## Explicit String Values

Use explicit strings when the wire value should differ from the member name.

```vdl
enum ProductStatus {
  Draft = "draft"
  Published = "published"
  Archived = "archived"
}
```

This is common when generated code should use nice member names while serialized data uses lowercase values.

## Integer Enums

Enums can use integer values.

```vdl
enum Priority {
  Low = 1
  Medium = 2
  High = 3
}
```

Integer values accept an optional leading minus with no space (e.g. `Below = -1`).

Values must fit in 64-bit signed range; out-of-range values are rejected.

For integer enums, every member must have an explicit integer value.

Invalid:

```vdl
enum Priority {
  Low = 1
  Medium
  High = 3
}
```

## Do Not Mix Value Kinds

An enum must be consistently string-based or integer-based.

Invalid:

```vdl
enum MixedStatus {
  Active = "active"
  Disabled = 2
}
```

## Unique Names And Values

Member names must be unique.

Invalid:

```vdl
enum Status {
  Active
  Active = "active"
}
```

Member values must also be unique.

Invalid:

```vdl
enum Status {
  Active = "enabled"
  Enabled = "enabled"
}
```

## Enum Member Docstrings

```vdl
enum InvoiceStatus {
  """ The invoice is editable and has not been sent. """
  Draft

  """ The invoice has been paid in full. """
  Paid
}
```

## Enum Member Annotations

```vdl
enum FeatureState {
  @deprecated("Use Enabled instead.")
  Active = "active"

  Enabled = "enabled"
}
```

Annotations on enum members are available to plugins.

## Enum Spreads

Enums can reuse members from another enum with `...Name`.

```vdl
enum StandardRole {
  Viewer = "viewer"
  Editor = "editor"
}

enum WorkspaceRole {
  ...StandardRole
  Owner = "owner"
}
```

Enum spreads must reference another enum and must use the `Name` form, not `Name.Member`.

Every enum must declare at least one member, counting inherited spread members. An enum with no members is rejected.

## Naming

Enum names and member names should use `PascalCase`.

```vdl
enum PaymentStatus {
  Pending
  Completed
  Failed
}
```
