# IIdentityService

- File ID: file:1ud0jop:iidentityservice-cs
- Path: NexusReader.Application/Abstractions/Services/IIdentityService.cs
- Role: service
- Layer: application

## Purpose

Defines the identity/authentication abstraction for the Application layer: registration, login/logout, profile retrieval, token refresh, and an event for state invalidation.

## Key Details

This file only declares the IIdentityService interface and an OnStateInvalidated event; concrete implementations elsewhere will perform orchestration, external calls, persistence, and error handling.

## Symbols

- OnStateInvalidated(): Event triggered when identity/authentication state becomes invalid and consumers should react (e.g., clear state or re-authenticate).
- RegisterAsync(): Registers a new user account using email and password and returns a success/failure Result.
- LoginAsync(): Authenticates a user with credentials and optional persistence (rememberMe) and returns a Result.
- LogoutAsync(): Logs out the current user and returns a Result indicating success/failure.
- GetProfileAsync(): Retrieves the current user's profile wrapped in a Result with UserProfileDto on success.
- RefreshTokenAsync(): Requests a token refresh for the current authentication session and returns a Result indicating success/failure.
- IIdentityService: Service contract defining identity/authentication operations and an event for invalidation.

## Dependencies

- imports NexusReader.Application/DTOs/User/UserProfileDto.cs

## Calls

- No resolved calls.

## Unresolved References

- dependency-target: FluentResults (external package)

## Coverage

- Symbols: 7
- Executable symbols: 6
- Executable symbols with control flow: 6
- Grounded edges: 8
- Unresolved references: 1
- Control-flow fragments: 6
- Unresolved jumps: 0
- Unsupported constructs: 0
- Control-flow coverage: 100%
- Required diagrams: 2
- Generated diagrams: 2

## Control Flow Fragments

- OnStateInvalidated: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- RegisterAsync: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- LoginAsync: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- LogoutAsync: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- GetProfileAsync: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- RefreshTokenAsync: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs

## Diagrams

### IIdentityService Neighborhood

```mermaid
flowchart LR
    file_1ud0jop_iidentityservice_cs("IIdentityService")
    method_12nj2l_registerasync[["RegisterAsync()"]]
    method_1gbqw83_refreshtokenasync[["RefreshTokenAsync()"]]
    method_1ww1s1_loginasync[["LoginAsync()"]]
    method_d5t49u_onstateinvalidated[["OnStateInvalidated()"]]
    method_urpd77_logoutasync[["LogoutAsync()"]]
    method_yzr6ph_getprofileasync[["GetProfileAsync()"]]
    file_1fs0p2c_userprofiledto_cs[/"UserProfileDto"/]
    type_udpmrx_iidentityservice[/"IIdentityService"/]
    file_1ud0jop_iidentityservice_cs -->|UserProfileDto| file_1fs0p2c_userprofiledto_cs
```

### IIdentityService Execution Overview

```mermaid
flowchart TD
    file_1ud0jop_iidentityservice_cs("IIdentityService")
    method_12nj2l_registerasync[["RegisterAsync()"]]
    method_1gbqw83_refreshtokenasync[["RefreshTokenAsync()"]]
    method_1ww1s1_loginasync[["LoginAsync()"]]
    method_d5t49u_onstateinvalidated[["OnStateInvalidated()"]]
    method_urpd77_logoutasync[["LogoutAsync()"]]
    method_yzr6ph_getprofileasync[["GetProfileAsync()"]]
    file_1ud0jop_iidentityservice_cs -->|contains| method_12nj2l_registerasync
    file_1ud0jop_iidentityservice_cs -->|contains| method_1gbqw83_refreshtokenasync
    file_1ud0jop_iidentityservice_cs -->|contains| method_1ww1s1_loginasync
    file_1ud0jop_iidentityservice_cs -->|contains| method_d5t49u_onstateinvalidated
    file_1ud0jop_iidentityservice_cs -->|contains| method_urpd77_logoutasync
    file_1ud0jop_iidentityservice_cs -->|contains| method_yzr6ph_getprofileasync
```

## Diagram Validation

- Status: pass
