# `ExScim.Operations.Groups`
[🔗](https://github.com/ExScim/ex_scim/blob/main/lib/ex_scim/operations/groups.ex#L1)

Orchestration layer for SCIM group operations.

Ties together schema validation, domain mapping, lifecycle hooks, and storage
for each SCIM operation (GET, LIST, POST, PUT, PATCH, DELETE). This is the
primary entry point used by controllers to execute group operations.

# `create_group_from_scim`

Creates a group from a SCIM JSON payload.

Validates the schema, maps to a domain struct, generates an ID if needed,
runs lifecycle hooks, stores, and maps back to SCIM.
Returns `{:ok, scim_group}` or `{:error, reason}`.

# `delete_group`

Deletes a group by ID with lifecycle hooks. Returns `:ok` or `{:error, reason}`.

# `get_group`

Retrieves a group by ID, applying lifecycle hooks and SCIM mapping. Returns `{:ok, scim_group}` or `{:error, reason}`.

# `list_groups_scim`

Lists groups as SCIM resources with filtering, sorting, and pagination.

`opts` may include `:filter`, `:sort_by`, `:sort_order`, `:start_index`, and `:count`.
Returns `{:ok, scim_groups, total_count}`.

# `patch_group_from_scim`

Applies a SCIM PATCH operation to an existing group.

Fetches the group, validates the patch payload, applies patch operations,
runs lifecycle hooks, and stores.
Returns `{:ok, scim_group}` or `{:error, reason}`.

# `replace_group_from_scim`

Fully replaces a group (PUT) from a SCIM JSON payload.

Verifies the group exists, validates, maps, runs lifecycle hooks, and stores.
Returns `{:ok, scim_group}` or `{:error, reason}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
