# Spark

**Kind:** Class

**Source:** `Pams/Web/Pams.WebApp/Client/app/core/models/dashboard-data-fields.ts` (line 501)

**Part of:** [Pams](subsystem-pams)

`Spark` stores dashboard field metadata, including hidden state, stored name, field name, measure type, and caption. Dashboard code updates these values through setter methods and reads them through matching getter methods.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `isHidden` | `isHidden()` | `boolean` |
| `setHidden` | `setHidden(flag: boolean)` | `void` |
| `GetStoredName` | `GetStoredName()` | `string` |
| `SetStoredName` | `SetStoredName(name: string)` | `void` |
| `GetFieldName` | `GetFieldName()` | `string` |
| `SetFieldName` | `SetFieldName(name: string)` | `void` |
| `GetType` | `GetType()` | `Measure` |
| `SetType` | `SetType(ty: Measure)` | `void` |
| `GetCaption` | `GetCaption()` | `string` |
| `SetCaption` | `SetCaption(input: string)` | `void` |
| `SetDataType` | `SetDataType(ty: DataTypeEnum)` | `void` |
| `GetDataType` | `GetDataType()` | `DataTypeEnum` |
| `GetFieldNameAgru` | `GetFieldNameAgru()` | `string` |
| `SetFieldNameAgru` | `SetFieldNameAgru(name: string)` | `void` |
| `GetStoredNameAgru` | `GetStoredNameAgru()` | `string` |
| `SetStoredNameAgru` | `SetStoredNameAgru(name: string)` | `void` |
| `GetTypeAgru` | `GetTypeAgru()` | `DateGroupEnum` |
| `SetTypeAgru` | `SetTypeAgru(dt: DateGroupEnum)` | `void` |

## Diagram

```mermaid
graph LR
  Spark --> Visibility[Visibility state]
  Spark --> Names[Field names]
  Spark --> Type[Measure type]
  Spark --> Caption[Caption]

  Visibility --> isHidden
  Visibility --> setHidden

  Names --> GetStoredName
  Names --> SetStoredName
  Names --> GetFieldName
  Names --> SetFieldName

  Type --> GetType
  Type --> SetType

  Caption --> GetCaption
  Caption --> SetCaption
```

## Usage

```ts
const spark = new Spark();

spark.SetStoredName("sales_amount");
spark.SetFieldName("SalesAmount");
spark.SetCaption("Sales Amount");

declare const selectedMeasure: Measure;
spark.SetType(selectedMeasure);

if (!spark.isHidden()) {
  console.log({
    storedName: spark.GetStoredName(),
    fieldName: spark.GetFieldName(),
    caption: spark.GetCaption(),
    type: spark.GetType(),
  });
}
```

## AI Coding Instructions

- Match the existing method casing, including `Get...` and `Set...` method names.
- Read names through `GetStoredName()` and `GetFieldName()` rather than duplicating field metadata elsewhere.
- Treat the value returned by `GetType()` as a `Measure`.
- Call `isHidden()` to inspect visibility; do not pass a Boolean to `setHidden()` because its declared signature has no argument.
