> ## Documentation Index
> Fetch the complete documentation index at: https://numadocs.secc.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Citation Service

> Handles logic related to the `Citation` model.

Namespace: [Numa.Services](numaservices)<br />
Related Models: [Citation.cs](../models/citation)<br />
Related Interfaces: `ICitationService.cs`

## Fields

| Field Name          | Type                             | Description                                                               |
| :------------------ | :------------------------------- | :------------------------------------------------------------------------ |
| `_dbContextFactory` | `IDbContextFactory<NumaContext>` | `DbContextFactory` for instantiating instances of `NumaContext` on-demand |

## Constructor

```csharp theme={null}
public CitationService( IDbContextFactory<NumaContext> dbContextFactory )
{
    _dbContextFactory = dbContextFactory ?? throw new ArgumentNullException( nameof( dbContextFactory ) );
}
```

## Properties

`CitationService` does not have any properties.

## Methods

| Method Name                          | Description                                                           | Parameters               | Return Type                                |
| :----------------------------------- | :-------------------------------------------------------------------- | :----------------------- | :----------------------------------------- |
| `AddNewCitationsAsync`               | Adds multiple citations to the Cosmos DB                              | `List<Citation>`         | `Task`                                     |
| `GetCitationsByConversdationIdAsync` | Gets the citations associated with each `Message` in a `Conversation` | `string`,`List<Message>` | `Task<Dictionary<string, List<Citation>>>` |

## ICitationService.cs

```csharp theme={null}
using Numa.Models;

namespace Numa.Interfaces
{
    public interface ICitationService
    {
        Task AddNewCitationsAsync( List<Citation> citations );
        Task<Dictionary<string, List<Citation>>> GetCitationsByConversdationIdAsync( string conversationId, List<Message> messages );
    }
}
```
