# Role

## Description

Role represents a named collection of permissions that can be assigned to users. Roles provide a level of abstraction between permissions and users, simplifying access management by allowing administrators to manage permissions at the role level rather than per-user. Common examples include "Sales Representative", "Sales Manager", or "Administrator".

Roles follow the principle of least privilege, bundling only the permissions necessary for a specific job function.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [createRole](../commands/CreateRole.md)

### Query Definitions

### Models

- Role

### Invariants

- Role name must be unique across all roles
- Role name is required and cannot be empty

### Relationships

- **Has Many RolePermissions**: Role contains permissions through RolePermission join records
- **Has Many UserRoles**: Role is assigned to users through UserRole join records
