# AttachedfileView

**Kind:** Class

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

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

`AttachedfileView` represents a file view model in the client application. It supports creating copies through `cloneFile()` and `clone()` so callers can work with duplicated file state without changing the original instance.

## Methods

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

## Properties

| Property | Type |
|---|---|
| `FileName` | `string` |
| `FileID` | `number` |
| `refrenceToID` | `number` |
| `refrenceToTypeID` | `number` |
| `MarkDelete` | `boolean` |
| `TagID` | `number` |
| `downloading` | `boolean` |

## Diagram

```mermaid
graph LR
  A[AttachedfileView] --> B[cloneFile()]
  A --> C[clone()]
  B --> D[Copied file state]
  C --> E[Copied AttachedfileView]
```

## Usage

```ts
function duplicateAttachment(file: AttachedfileView): AttachedfileView {
  const copiedFile = file.cloneFile();
  const copiedView = file.clone();

  // Use the copied view when editing attachment state.
  return copiedView;
}
```

## AI Coding Instructions

- Use `cloneFile()` when code needs a copied file object rather than the current file reference.
- Use `clone()` when passing a duplicated `AttachedfileView` into UI state or edit flows.
- Do not modify an instance that is shared by multiple components; clone it before applying local changes.
- Keep cloning behavior aligned between `cloneFile()` and `clone()` when file-related fields change.

## 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)

- `FilesService` — `Pams/Web/Pams.WebApp/Client/app/services/common/files.service.ts`:1
- `ClientDelay` — `Pams/Web/Pams.WebApp/Client/app/models/sales/client-delay.model.ts`:2
