# Inquiry

**Kind:** Class

**Source:** `Frontend/src/app/models/sales/inquiry.model.ts` (line 36)

**Part of:** [Frontend](subsystem-frontend-src-app)

`Inquiry` models a sales inquiry and groups operations for cloning, version changes, and order duplication. It is used where the application needs to create or select inquiry versions while keeping the active version in sync.

## 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 |
|---|---|
| `InquiryContacts` | `InquiryContact[]` |
| `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` |
| `Selected` | `boolean` |
| `IsInquiryEmailedToPrincipal` | `boolean` |
| `InquiryEmailedToPrincipalDate` | `Date` |
| `Comments` | `Comment[]` |
| `InquiryTypeID` | `number` |
| `CurrentJobStatusID` | `number` |
| `Description` | `string` |
| `FileNo` | `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()]
  Version[duplicateVersion()]
  Switch[switchVersion()]
  NewVersion[createNewOrderVersion()]
  Current[setCurrentVersion()]
  Order[DuplicateOrder()]

  Inquiry --> Clone
  Inquiry --> Version
  Inquiry --> Switch
  Inquiry --> NewVersion
  Inquiry --> Current
  Inquiry --> Order
```

## Usage

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

function createInquiryVersion(inquiry: Inquiry): Inquiry {
  const copiedInquiry = inquiry.clone();

  copiedInquiry.duplicateVersion();
  copiedInquiry.createNewOrderVersion();
  copiedInquiry.setCurrentVersion();

  return copiedInquiry;
}

function duplicateInquiryOrder(inquiry: Inquiry): void {
  inquiry.DuplicateOrder();
}
```

## AI Coding Instructions

- Use `clone()` when a separate `Inquiry` instance is needed before changing version or order state.
- Preserve the existing `DuplicateOrder()` capitalization when calling the method.
- Treat version-related methods as state-changing operations and confirm the active version with `setCurrentVersion()`.
- Check callers of `switchVersion()` when changing version flow, since UI state may depend on the selected inquiry version.

## Used by

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

### Imported by (4)

- `NewJobComponent` — `Frontend/src/app/components/sales/new-job/new-job.component.ts`:1
- `TagComponent` — `Frontend/src/app/components/shared/tag/tag.component.ts`:1
- `ValidationModel` — `Frontend/src/app/services/sales/date-validation-service.service.ts`:1
- `InquiryService` — `Frontend/src/app/services/sales/inquiry.service.ts`:1
