# Company

**Kind:** Class

**Source:** `Pams/Logic/Pams.Business/Entity/Organization/Company.Model.cs` (line 10)

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

`Company` is a C# entity model that represents an organization company record in the PAMS business layer. It stores company identity, branding, status, web presence, and branch-sharing settings for related account and contact data.

## Diagram

```mermaid
graph LR
    Company[Company]
    Identity[Identity]
    Branding[Branding]
    Settings[Organization Settings]

    Company --> Identity
    Company --> Branding
    Company --> Settings

    Identity --> CompanyID[CompanyID: int]
    Identity --> RowGuid[RowGuid: Guid?]

    Branding --> Name[Name: string]
    Branding --> Website[Website: string]
    Branding --> Slogan[Slogan: string]
    Branding --> Subdomain[Subdomain: string]
    Branding --> Logo[Logo: string]

    Settings --> IsActive[IsActive: bool]
    Settings --> ShareAccount[ShareAccountWithBranches: int?]
    Settings --> ShareContact[ShareContactWithBranches: int?]
```

## Usage

```ts
type Company = {
  CompanyID: number;
  RowGuid: string | null;
  Name: string;
  Website: string;
  Slogan: string;
  Subdomain: string;
  IsActive: boolean;
  Logo: string;
  ShareAccountWithBranches: number | null;
  ShareContactWithBranches: number | null;
};

async function saveCompany(companyId: number): Promise<Company> {
  const company: Company = {
    CompanyID: companyId,
    RowGuid: null,
    Name: "Example Company",
    Website: "https://example.com",
    Slogan: "Helping customers",
    Subdomain: "example",
    IsActive: true,
    Logo: "/images/example-logo.svg",
    ShareAccountWithBranches: null,
    ShareContactWithBranches: null,
  };

  const response = await fetch("/api/companies", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(company),
  });

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

  return response.json();
}
```

## AI Coding Instructions

- Keep `CompanyID` as the primary integer identifier and preserve `RowGuid` as nullable when no GUID is assigned.
- Treat `ShareAccountWithBranches` and `ShareContactWithBranches` as nullable integer settings, not boolean values.
- Preserve the current property names when mapping API payloads if the backend serializer expects PascalCase fields.
- Check `IsActive` before presenting a company as available in organization, account, or contact workflows.

## Relationships

- IMPORTS → `Company`
- IMPORTS → `PostedFile`
- IMPORTS → `EntityBase`
- IMPORTS → `PamsLinqDataContext`

## Used by

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

### Imported by (11)

- `CompanyBranchDepartmentController` — `Pams/API/Pams.API/Controllers/Organization/CompanyBranchDepartmentController.cs`:29
- `CompanyBranchSettingController` — `Pams/API/Pams.API/Controllers/Organization/CompanyBranchSettingController.cs`:24
- `CompanyController` — `Pams/API/Pams.API/Controllers/Organization/CompanyController.cs`:26
- `AccountsController` — `Pams/API/Pams.API/Controllers/Person/AccountsController.cs`:23
- `JobDocumentController` — `Pams/API/Pams.API/Controllers/Sales/JobDocumentController.cs`:19
- `Company` — `Pams/Logic/Pams.Business/Entity/Organization/Company.Model.cs`:10
- `Person` — `Pams/Logic/Pams.Business/Entity/Person/Person.Model.cs`:11
- `Activity` — `Pams/Data/Pams.Data/CRMLinq.designer.cs`:11344

…and 3 more.
