# Inquiry

**Kind:** Class

**Source:** `Pams/Web/Pams.WebApp/Client/app/models/sales/inquiry.model.ts` (line 31)

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

`Inquiry` models a sales inquiry and manages order version actions within the client application. It can clone an inquiry, create or duplicate order versions, switch the active version, and set the current version.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `clone` | `clone(Inq: Inquiry)` | `Inquiry` |
| `duplicateVersion` | `duplicateVersion(versionIndex: number)` | `void` |
| `DuplicateOrder` | `DuplicateOrder()` | `void` |
| `switchVersion` | `switchVersion(versionIndex: number)` | `void` |
| `createNewOrderVersion` | `createNewOrderVersion()` | `void` |
| `setCurrentVersion` | `setCurrentVersion(statusId: number)` | `void` |

## Properties

| Property | Type |
|---|---|
| `tabStatus` | `number` |
| `InquiryNumber` | `number` |
| `JobNo` | `string` |
| `CompanyBranchID` | `number` |
| `ResponsibleID` | `number` |
| `ClientID` | `number` |
| `SupplierID` | `number` |
| `CategoryTypeID` | `number` |
| `CategoryID` | `number` |
| `ProjectID` | `number` |
| `CategoryDescription` | `string` |
| `InquiryDate` | `Date` |
| `ProductTypeID` | `number` |
| `UserDisplayName` | `string` |
| `isUpdaating` | `boolean` |
| `reverted` | `boolean` |
| `EndUserTypeID` | `number` |
| `EndUserID` | `number` |
| `newstory` | `JobVersionStatusLog` |
| `ClientInquiryNumber` | `string` |
| `BidDueDate` | `Date` |
| `InquiryTypeID` | `number` |
| `CurrentJobStatusID` | `number` |
| `Description` | `string` |
| `CurrentJobProcess` | `JobProcess` |
| `JobVersionsList` | `JobVersion[]` |
| `CurrentJobVersion` | `JobVersion` |
| `CurrentOfferJobVersion` | `JobVersion` |
| `CurrentOrderJobVersion` | `JobVersion` |
| `BidBondDetails` | `JobGuarantee` |

## Where it refuses work

- `Inquiry` stops the work with an early return when `this.InquiryDate == null`.
- `Inquiry` stops the work with an early return when `this.BidDueDate == null`.
- `Inquiry` stops the work with an early return when `this.CurrentJobStatusID == JobStatusE.Bin`.
- `Inquiry` stops the work with an early return when `this.CurrentJobStatusID == JobStatusE.Inquiry || this.CurrentJobStatusID == JobStatusE.Of…`.

## Diagram

```mermaid
graph LR
  Inquiry[Inquiry]
  Clone[clone]
  DuplicateVersion[duplicateVersion]
  DuplicateOrder[DuplicateOrder]
  SwitchVersion[switchVersion]
  CreateVersion[createNewOrderVersion]
  SetCurrentVersion[setCurrentVersion]

  Inquiry --> Clone
  Inquiry --> DuplicateVersion
  Inquiry --> DuplicateOrder
  Inquiry --> SwitchVersion
  Inquiry --> CreateVersion
  Inquiry --> SetCurrentVersion
```

## Usage

```ts
import { Inquiry } from './models/sales/inquiry.model';

function createDraft(inquiry: Inquiry): Inquiry {
  const draft = inquiry.clone();

  draft.createNewOrderVersion();
  draft.setCurrentVersion();

  return draft;
}

function copyExistingVersion(inquiry: Inquiry): void {
  inquiry.duplicateVersion();
  inquiry.switchVersion();
}
```

## AI Coding Instructions

- Treat `clone()` as the operation for creating an independent `Inquiry` instance before changing draft state.
- Use version methods together when changing the active order version: create or duplicate a version, then set or switch the current version.
- Preserve existing method naming, including `DuplicateOrder()`, when calling or extending this class.
- Check callers that depend on the current version after invoking `switchVersion()` or `setCurrentVersion()`.

## Used by

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

### Imported by (2)

- `ValidationModel` — `Pams/Web/Pams.WebApp/Client/app/services/sales/date-validation-service.service.ts`:1
- `InquiryService` — `Pams/Web/Pams.WebApp/Client/app/services/sales/inquiry.service.ts`:1
