# Asset Part API

API for managing asset parts

**Version:** 1.0.0

## Overview

### Base URLs

- **Production server**: `https://sv.api.repzo.me`

- **Staging server**: `https://staging.sv.api.repzo.me`

### API Categories

- **Asset Part**: Operations related to asset part management

## Authentication

This API uses the following authentication methods:

- **ApiKeyAuth**

## Endpoints

### `/asset-part`

#### GET /asset-part

**Summary:** Get all asset parts

**Description:** Retrieve a list of all asset parts with optional filtering and pagination

**Tags:** Asset Part

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `limit` | query | integer | No | Maximum number of records to return |

| `offset` | query | integer | No | Number of records to skip for pagination |

| `sort` | query | string | No | Field to sort by |

| `order` | query | string | No | Sort order (asc or desc) |

| `filter` | query | string | No | Filter conditions in JSON format |

| `search` | query | string | No | Search term for text fields |

##### Responses

**200** - List of asset parts retrieved successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

#### POST /asset-part

**Summary:** Create a new asset part

**Description:** Create a new asset part with the provided data

**Tags:** Asset Part

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**201** - Asset part created successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

### `/asset-part/{id}`

#### GET /asset-part/{id}

**Summary:** Get asset part by ID

**Description:** Retrieve a specific asset part by its ID

**Tags:** Asset Part

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | Asset part ID |

##### Responses

**200** - Asset part retrieved successfully

Content-Type: `application/json`

**404** - Asset part not found

**401** - Unauthorized

**500** - Internal server error

---

#### PUT /asset-part/{id}

**Summary:** Update asset part

**Description:** Update an existing asset part with new data

**Tags:** Asset Part

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | Asset part ID |

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**200** - Asset part updated successfully

Content-Type: `application/json`

**400** - Bad request

**404** - Asset part not found

**401** - Unauthorized

**500** - Internal server error

---

#### DELETE /asset-part/{id}

**Summary:** Delete asset part

**Description:** Delete an existing asset part

**Tags:** Asset Part

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | Asset part ID |

##### Responses

**200** - Asset part deleted successfully

Content-Type: `application/json`

**404** - Asset part not found

**401** - Unauthorized

**500** - Internal server error

---

## Data Models

### AssetPart

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |

| `_id` | string | No | Unique identifier for the asset part |

| `partNumber` | string | Yes | Unique part number |

| `name` | string | Yes | Name of the asset part |

| `description` | string | No | Description of the asset part |

| `partType` | string | Yes | Asset part type ID |

| `manufacturer` | string | No | Manufacturer name |

| `model` | string | No | Part model number |

| `specifications` | object | No | Technical specifications |

| `compatibleAssets` | array | No | List of compatible asset IDs |

| `supplier` | string | No | Primary supplier ID |

| `cost` | number | No | Current cost of the part |

| `currency` | string | No | Currency code |

| `minStockLevel` | integer | No | Minimum stock level |

| `maxStockLevel` | integer | No | Maximum stock level |

| `reorderPoint` | integer | No | Reorder point threshold |

| `leadTime` | integer | No | Lead time in days |

| `warrantyPeriod` | integer | No | Warranty period in days |

| `category` | string | No | Part category |

| `subcategory` | string | No | Part subcategory |

| `isActive` | boolean | No | Whether the part is active |

| `barcode` | string | No | Barcode for the part |

| `qrCode` | string | No | QR code for the part |

| `images` | array | No | Part images URLs |

| `documents` | array | No | No description |

| `metadata` | object | No | Additional metadata |

| `createdAt` | string | No | Record creation timestamp |

| `updatedAt` | string | No | Record last update timestamp |

### AssetPartInput

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |

| `partNumber` | string | Yes | Unique part number |

| `name` | string | Yes | Name of the asset part |

| `description` | string | No | Description of the asset part |

| `partType` | string | Yes | Asset part type ID |

| `manufacturer` | string | No | Manufacturer name |

| `model` | string | No | Part model number |

| `specifications` | object | No | Technical specifications |

| `compatibleAssets` | array | No | List of compatible asset IDs |

| `supplier` | string | No | Primary supplier ID |

| `cost` | number | No | Current cost of the part |

| `currency` | string | No | Currency code |

| `minStockLevel` | integer | No | Minimum stock level |

| `maxStockLevel` | integer | No | Maximum stock level |

| `reorderPoint` | integer | No | Reorder point threshold |

| `leadTime` | integer | No | Lead time in days |

| `warrantyPeriod` | integer | No | Warranty period in days |

| `category` | string | No | Part category |

| `subcategory` | string | No | Part subcategory |

| `isActive` | boolean | No | Whether the part is active |

| `barcode` | string | No | Barcode for the part |

| `qrCode` | string | No | QR code for the part |

| `images` | array | No | Part images URLs |

| `documents` | array | No | No description |

| `metadata` | object | No | Additional metadata |

## TypeScript Usage

See [asset-part-examples.md](./asset-part-examples.md) for detailed TypeScript usage examples.
