# Create Role

## User Story

As a user with the appropriate role, I want to create a new role with permissions, so that I can define access levels.

## Story Diagram

```mermaid
flowchart TD
    A[Open Role List] --> B[Click Create]
    B --> C[Enter role name]
    C --> D[Select permissions]
    D --> E[Submit]
    E --> F{Validation}
    F -- Role name already exists --> G[Show duplicate name error]
    F -- Required field missing --> H[Show validation error]
    F -- Valid --> I[Role created and available for assignment]
```

## Scenario Patterns

- Create a role with a unique name and one or more permissions
- Duplicate role name is rejected with an error
- Submission with a missing role name is blocked by validation

## Test Cases

- Submit the form with a unique name and selected permissions; verify the role appears in the role list
- Submit the form with a name already used by an existing role; verify an error is shown and no role is created
- Submit the form with the name field empty; verify a validation error is shown and submission is blocked

## Screens

- [role-list](../../../screen/role-list.md)
- [role-create-form](../../../screen/role-create-form.md)

## Resolvers

- [createRole](../../../resolver/createRole.md)
- [assignPermissionToRole](../../../resolver/assignPermissionToRole.md)
