# Objects

## CompanyReference

Uniquely identifies a company.

| Field name | Data type | Description |
|---|---|---|
| `companyId` | `string` | Output only. The ID of the company, assigned by the server. |
| `vendor` | `enum` | `Samsung` or `Google`. |

## Company

Represents a company.

| Field name | Data type | Description |
|---|---|---|
| `companyReference` | `object(`[`CompanyReference`](https://developers.google.com/zero-touch/reseller-library/reference/objects#companyreference)`)` | Company reference object. |
| `companyName` | `string` | The name of the company. For example *XYZ Corp*. Displayed to the company's employees in the zero-touch enrollment portal. |
| `vendorParams` | `map` | Extra fields in vendor-specified key-value pairs. |

## Device

An Android device registered for enrollment.

| Field name | Data type | Description |
|---|---|---|
| `deviceId` | `string` | Output only. The ID of the device, assigned by the server. |
| `deviceIdentifier` | `object(`[`DeviceIdentifier`](https://developers.google.com/zero-touch/reseller-library/reference/objects#deviceidentifier)`)` | The hardware IDs that identify a manufactured device. |
| `customer` | `object(`[`CompanyReference`](https://developers.google.com/zero-touch/reseller-library/reference/objects#companyreference)`)` | The company IDs that identify which company the devices is assigned to. |
| `orderNumber` | `string` | The order number. |
| `vendorParams` | `map` | Extra fields in vendor-specified key-value pairs. |

## DeviceIdentifier

Encapsulates hardware and product IDs to identify a manufacturer's device.

Samsung devices require **one** of the following fields:

- `IMEI`
- `serialNumber`
- `meid`

All other fields, like `model`, are ignored.

For all other Android devices:

- Cellular devices require `imei` and `manufacturer`.
- WiFi-only devices require `serialNumber`, `manufacturer`, and `model`.

| Field name | Data type | Description |
|---|---|---|
| `imei` | `string` | The device's IMEI number. Validated on input. |
| `serialNumber` | `string` | The manufacturer's serial number for the device. This value might not be unique across different device models. |
| `meid` | `string` | The device's MEID number. |
| `manufacturer` | `string` | The device manufacturer's name. Matches the device's built-in value returned from `android.os.Build.MANUFACTURER`. Allowed values are listed in [manufacturers](https://developers.google.com/zero-touch/resources/manufacturer-names#manufacturers-names). |
| `model` | `string` | The device model's name. Matches the device's built-in value returned from `android.os.Build.MODEL`. Allowed values are listed in [models](https://developers.google.com/zero-touch/resources/manufacturer-names#model-names). |

## Operation

This resource contains the status of an asynchronous API call. There are four
possible statuses:

- `IN_PROGRESS`: The operation is in progress.
- `COMPLETE`: All devices were successfully processed.
- `COMPLETE_WITH_ERRORS`: The operation was processed, but some errors occurred. All errors are listed in the `deviceErrors` list.
- `FAILED`: The operation failed and no `operationId` is returned.

| Field name | Data type | Description |
|---|---|---|
| `operationId` | `string` | The operation ID, prefixed with `samsung/` or `google/`. If empty,`state` is `FAILED`. |
| `operationType` | `enum(operationType)` | The operation type: `CLAIM_DEVICES` or `UNCLAIM_DEVICES`. |
| `state` | `enum(operationState)` | The operation state: `IN_PROGRESS`, `COMPLETE`, `COMPLETE_WITH_ERRORS`, `FAILED`. |
| `deviceErrors` | List of `object(`[`DeviceOperationError`](https://developers.google.com/zero-touch/reseller-library/reference/objects#deviceoperationerror)`)` | List of device operation errors. |
| `vendorParams` | `map` | Extra fields in vendor-specified key-value pairs. |

## DeviceOperationError

A device-specific error in an `Operation`. Each resource contains the same
`deviceId` and `deviceIdentifier` as the request that started the operation.

| Field name | Data type | Description |
|---|---|---|
| `deviceId` | `string` | Output only. The ID of the device, assigned by the server. |
| `deviceIdentifier` | `object(`[`DeviceIdentifier`](https://developers.google.com/zero-touch/reseller-library/reference/objects#deviceidentifier)`)` | The hardware IDs that identify a manufactured device. |
| `error` | `object(`[`Error`](https://developers.google.com/zero-touch/reseller-library/reference/objects#error)`)` | The device operation error. |

## CommonException

An exception that can be thrown by all synchronous APIs.

| Property name | Value | Description |
|---|---|---|
| `error` | `object(`[`Error`](https://developers.google.com/zero-touch/reseller-library/reference/objects#error)`)` | Synchronous operation error. |

## Error

An object containing details about an error.

| Property name | Value | Description |
|---|---|---|
| `code` | `enum(`[`ErrorCode`](https://developers.google.com/zero-touch/reseller-library/reference/objects#errorcode)`)` | The error code. For example, `INVALID_REQUESET` or `PERMISSION_DENIED` |
| `message` | `string` | The error message. |
| `vendorMsg` | `string` | A detailed explanation of the error from the vendor. |
| `errorId` | `string` | The internal error identifier. |
| `vendorParams` | `map` | Extra fields in vendor-specified key-value pairs. |

## ErrorCode

Common errors.

| Enum | Description |
|---|---|
| `INVALID_PARAM_DEFAULT` | Unspecified invalid input parameter. Look at the vendorMsg to get more details. |
| `INVALID_PAGE_TOKEN` | The pageToken that was provided is invalid. |
| `INVALID_CUSTOMER_ID` | The customerId provided is invalid. |
| `INVALID_DEVICE_IMEI` | Invalid IMEI. |
| `INVALID_DEVICE_MEID` | Invalid MEID. |
| `INVALID_DEVICE_SERIAL` | Invalid Serial number. |
| `INVALID_OPERATION_ID` | The operationId provided is invalid. |
| `INVALID_RESELLER_ID` | The resellerId provided is invalid. |
| `INVALID_MANUFACTURER` | The manufacturer provided is invalid / unsupported. |
| `INVALID_IDENTIFIER_SET` | The set of identifiers provided is not sufficient for the request. See [`DeviceIdentifier`](https://developers.google.com/zero-touch/reseller-library/reference/objects#deviceidentifier) for more information on allowed identifier sets. |
| `INVALID_MODEL` | The model provided is invalid / unsupported. |
| `INVALID_DEVICE_ID` | The deviceId provided is invalid. |
| `INVALID_DEVICE` | The provided device does not exist. This is a Samsung specific error code. |
| `DUPLICATE_DEVICE` | The device was previously claimed to the same customer. No corrective action required. |
| `DEVICE_UPLOAD_COUNT_EXCEEDED` | The request contains more devices that the limit (currently 100k). |
| `AUTHORIZATION_FAIL` | You do not have access to a given resource (e.g. device, customer), or the resource does not exist. Look at `vendorMsg` to get more details. |
| `INTERNAL_SERVER_ERROR` | Unspecified internal server error. Look at vendorMsg to get more details. These requests can be retried depending on the nature of the server error. |
| `NOT_IMPLEMENTED` | The request method is not supported by the server. |