# Interface IRelayService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface IRelayService

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### CheckRelayStatus(ObjectId)

Asynchronously checks the current status of the relay identified by the specified identifier.

    Task<RelayEnum.Status> CheckRelayStatus(ObjectId relayId)

#### Parameters

`relayId` ObjectId

  The unique identifier of the relay whose status is being queried.

#### Returns

Task<RelayEnum.Status>

  A task that represents the asynchronous operation, containing the RelayEnum.Status of the requested relay.

### CheckRelayStatus(Relay)

Asynchronously checks the current status of the specified relay.

    Task<RelayEnum.Status> CheckRelayStatus(Relay relay)

#### Parameters

`relay` Relay

  The relay whose status is being checked.

#### Returns

Task<RelayEnum.Status>

  A task that represents the asynchronous operation, containing the current RelayEnum.Status of the relay.

### GetById(ObjectId)

Retrieves a relay by its unique identifier, returning `null` if no matching relay is found.

    Task<Relay?> GetById(ObjectId relay)

#### Parameters

`relay` ObjectId

  The unique identifier of the relay to look up.

#### Returns

Task<Relay>

  A Task<TResult> that resolves to the Relay if found, or `null` if no relay matches the provided identifier.

### GetPaginatedRelays(PaginationFilter)

Retrieves a paginated list of relays based on the specified pagination filter.

    Task<PaginationResponse<Relay>> GetPaginatedRelays(PaginationFilter request)

#### Parameters

`request` PaginationFilter

  The pagination filter containing the criteria used to retrieve the relays.

#### Returns

Task<PaginationResponse<Relay>>

  A task that represents the asynchronous operation, containing the paginated response with the requested relays.

### GetRelayByTypeInList(List<ObjectId>?, Type)

Retrieves the relays of a specified type from the provided configuration relay list.

    List<Relay> GetRelayByTypeInList(List<ObjectId>? configurationRelayList, RelayEnum.Type type)

#### Parameters

`configurationRelayList` List<ObjectId>

  The list of relay ObjectIds to filter, or null if no configuration relays are available.

`type` RelayEnum.Type

  The relay type to match against the configuration relays.

#### Returns

List<Relay>

  A list of Relay objects that match the specified `type`.

### GetRelayInList(List<ObjectId>?)

Retrieves the list of Relay objects corresponding to the specified collection of relay identifiers.

    List<Relay> GetRelayInList(List<ObjectId>? relayList)

#### Parameters

`relayList` List<ObjectId>

  The list of MongoDB.Bson.ObjectId values identifying the relays to retrieve. May be `null`.

#### Returns

List<Relay>

  A List<T> containing the relays found for the provided identifiers.

### InsertRelay(Relay)

Inserts a new relay record based on the provided request data.

    Task<Relay?> InsertRelay(Relay request)

#### Parameters

`request` Relay

  The relay entity to be inserted.

#### Returns

Task<Relay>

  A task that resolves to the inserted Relay, or `null` if the insert did not return a value.

### PowerOff(Relay)

Powers off the specified relay by sending a command to deactivate it.

    Task PowerOff(Relay relay)

#### Parameters

`relay` Relay

  The relay to power off.

#### Returns

Task

### PowerOn(Relay)

Powers on the specified relay.

    Task PowerOn(Relay relay)

#### Parameters

`relay` Relay

  The relay to power on.

#### Returns

Task

### SetManualRelay(Status, ObjectId, Type)

Sets a manual relay with the specified status for the given point of contact and relay type.

    Task SetManualRelay(RelayEnum.Status status, ObjectId pocId, RelayEnum.Type type)

#### Parameters

`status` RelayEnum.Status

  The status to apply to the manual relay.

`pocId` ObjectId

  The identifier of the point of contact associated with the relay.

`type` RelayEnum.Type

  The type of relay to set manually.

#### Returns

Task

### UpdateRelayById(ObjectId, Relay)

Updates an existing relay identified by the specified `objectId` with the provided `relay` data. Returns `null` when no relay is found with the given identifier.

    Task<Relay?> UpdateRelayById(ObjectId objectId, Relay relay)

#### Parameters

`objectId` ObjectId

  The unique identifier of the relay to update.

`relay` Relay

  The relay data containing the updated values.

#### Returns

Task<Relay>

  A task that resolves to the updated Relay, or `null` if the relay was not found.