# AttachedfileView

**Kind:** Class

**Source:** `Pams/Web/Pams.Web/Client/app/models/common/files.model.ts` (line 180)

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

`AttachedfileView` represents an attached file in the client-side file model layer. Its `cloneFile()` and `clone()` methods create copies for workflows that need to preserve the original file view while working with a separate instance.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `cloneFile` | `cloneFile(file: File)` | `void` |
| `clone` | `clone(e: AttachedfileView)` | `void` |

## Properties

| Property | Type |
|---|---|
| `FileName` | `string` |
| `FileID` | `number` |
| `CompanyBranchID` | `number` |
| `refrenceToID` | `number` |
| `refrenceToTypeID` | `number` |
| `FileTypeId` | `number` |
| `VersionNo` | `number` |
| `NameSuffix` | `string` |
| `MarkDelete` | `boolean` |
| `TagID` | `number` |
| `FileType` | `string` |
| `FilePath` | `string` |
| `CloudTypeId` | `number` |
| `CloudItemId` | `string` |
| `SizeInBytes` | `string` |
| `ModificationDate` | `Date` |
| `downloading` | `boolean` |

## Diagram

```mermaid
graph LR
  AttachedfileView[AttachedfileView]
  AttachedfileView --> CloneFile[cloneFile()]
  AttachedfileView --> Clone[clone()]
  CloneFile --> FileCopy[File copy]
  Clone --> ViewCopy[AttachedfileView copy]
```

## Usage

```ts
function prepareAttachmentCopy(attachedFileView: AttachedfileView) {
  const fileCopy = attachedFileView.cloneFile();
  const viewCopy = attachedFileView.clone();

  return {
    fileCopy,
    viewCopy,
  };
}
```

## AI Coding Instructions

- Use `cloneFile()` when downstream code needs a separate copy of the attached file data.
- Use `clone()` when copying the `AttachedfileView` instance for editing or state changes.
- Keep cloning at state boundaries so changes to a copied attachment do not affect the original view.
- Check callers for assumptions about whether cloned objects share nested references.

## Used by

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

### Imported by (6)

- `DocsListComponent` — `Pams/Web/Pams.Web/Client/app/components/shared/attached-docs/shared-attached-docs/docs-list/docs-list.component.ts`:1
- `SharedAttachedDocsComponent` — `Pams/Web/Pams.Web/Client/app/components/shared/attached-docs/shared-attached-docs/shared-attached-docs.component.ts`:1
- `AttachmentDropdownComponent` — `Pams/Web/Pams.Web/Client/app/components/shared/dropdown/attachment-dropdown/attachment-dropdown.component.ts`:1
- `InspectionDetailsComponent` — `Pams/Web/Pams.Web/Client/app/components/warehouse/inspection-details/inspection-details.component.ts`:1
- `UploadFilePopup` — `Pams/Web/Pams.Web/Client/app/services/common/files.service.ts`:1
- `ClientDelay` — `Pams/Web/Pams.Web/Client/app/models/sales/client-delay.model.ts`:2
