# Account

**Kind:** Class

**Source:** `Pams/Data/Pams.Data/PamsLinq5.designer.cs` (line 166863)

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

`Account` is a C# data model representing an account record in the Pams data layer. It stores account identity, company ownership, currency, type, display names, VAT data, status, image path, and principal-account state.

## Diagram

```mermaid
graph LR
  Account["Account"]
  Account --> PrimaryID["PrimaryID: long"]
  Account --> CompanyID["CompanyID: Nullable<int>"]
  Account --> Currency["AccountCurrencyCode: string"]
  Account --> AccountTypeID["AccountTypeID: Nullable<int>"]
  Account --> Name["Name: string"]
  Account --> FullName["FullName: string"]
  Account --> Vat["Vat: string"]
  Account --> IsActive["IsActive: Nullable<bool>"]
  Account --> ImgPath["ImgPath: string"]
  Account --> IsPrincipal["IsPrincipal: bool"]
```

## Usage

```ts
type Account = {
  primaryID: number;
  companyID: number | null;
  accountCurrencyCode: string;
  accountTypeID: number | null;
  name: string;
  fullName: string;
  vat: string;
  isActive: boolean | null;
  imgPath: string;
  isPrincipal: boolean;
};

async function getAccount(primaryID: number): Promise<Account> {
  const response = await fetch(`/api/accounts/${primaryID}`);

  if (!response.ok) {
    throw new Error("Unable to load account");
  }

  return response.json();
}

const account = await getAccount(123);

if (account.isActive && account.isPrincipal) {
  console.log(`Principal account: ${account.fullName}`);
}
```

## AI Coding Instructions

- Treat `PrimaryID` as the account identifier when reading, updating, or linking account records.
- Handle `CompanyID`, `AccountTypeID`, and `IsActive` as nullable values before using them in application logic.
- Preserve `AccountCurrencyCode` when creating integrations involving balances, invoices, or financial reporting.
- Use `IsPrincipal` to distinguish the primary account from other account records for the same company.
- Keep API field naming consistent with the serialization settings used by the .NET application.

## Relationships

- IMPORTS → `Person`
- IMPORTS → `Account`
- IMPORTS → `AddressBindingModel`
- IMPORTS → `ContactInfoBindingModel`
- IMPORTS → `ContactPersonBindingModel`
- IMPORTS → `CommentsView`
- IMPORTS → `Comments`
- IMPORTS → `City`
- IMPORTS → `Country`

## Used by

9 references from 9 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (9)

- `FilesController` — `Pams/API/Pams.API/Controllers/Common/FilesController.cs`:27
- `CompanyBranchController` — `Pams/API/Pams.API/Controllers/Organization/CompanyBranchController.cs`:21
- `Account` — `Pams/Data/Pams.Data/PamsLinq5.designer.cs`:166863
- `AccountViewModel` — `Pams/Logic/Pams.Business/BindingModels/Person/AccountsBindingModel.cs`:6
- `ReturnData` — `Pams/Logic/Pams.Business/Component/NewSales/SalesOfferLogic.cs`:2637
- `MeetingParticipantsBindingModel` — `Pams/Logic/Pams.Business/Component/Person/AccountsLogic.Logic.cs`:2717
- `EndUser` — `Pams/Logic/Pams.Business/Domain/Import/ImportDomain.cs`:3891
- `ContactPerson` — `Pams/Logic/Pams.Business/Entity/Common/ContactPerson.Model.cs`:14

…and 1 more.
