# Example Collection

## Collection Metadata

The `meta` object within the collection JSON file provides metadata or general information about the collection itself. It includes the following properties:

- `_id`: A unique identifier for the collection.
- `name`: The name of the collection.
- `description`: A brief description of the collection.
- `type`: The type of collection (in this case, "genericCollection").
- `image`: An optional base64-encoded image representing the collection.

## Attributes

The `attributes` array defines the properties or attributes that each item within the collection can have. Each attribute is represented as an object with the following properties:

- `_id`: A unique identifier for the attribute.
- `name`: The name of the attribute.
- `type`: The data type of the attribute. The example collection includes the following types:
  - `string`: A text value.
  - `number`: A numeric value.
  - `enum`: A value from a predefined set of options (e.g., "S", "M", "L", "XL", "XXL" for the "Size" attribute).
  - `integer`: An integer value.
  - `boolean`: A true or false value.
- `order`: The order or position of the attribute within the collection.
- `options` (for `enum` types): An array of possible values for the attribute.

## Example Collection JSON

```json
{
    "meta": {
        "_id": "ae933ea2-0305-4a77-8923-3a0f84dff1a3",
        "name": "Example Collection",
        "description": "Example collection description",
        "type": "genericCollection",
        "image": "data:image/png;base64,iVBCg..."
    },
    "attributes": [
        {
            "_id": "de54b737-1c8f-4ef2-bfea-d6b01cf3b92f",
            "name": "Color",
            "type": "string",
            "order": 0
        },
        {
            "_id": "aa4f8726-1265-46e6-9b2b-5ebbd26bd562",
            "name": "Price",
            "type": "number",
            "order": 1
        },
        {
            "_id": "ff8ff854-da72-455c-8936-466cb61c398a",
            "name": "Size",
            "type": "enum",
            "order": 2,
            "options": [
                "S",
                "M",
                "L",
                "XL",
                "XXL"
            ]
        },
        {
            "_id": "3fcf2612-2586-49c7-ad3e-6413ebf7436e",
            "name": "Length (m)",
            "type": "integer",
            "order": 4
        },
        {
            "_id": "eeb3ce29-ca66-4b93-bb95-8e7d7b96c798",
            "name": "Available",
            "type": "boolean",
            "order": 5
        }
    ]
}
```

## Attribute Values

This example contains an array of objects, each representing an item within the collection. Each object has the following properties:

- `i`: The product code reference.
- `values`: An object containing key-value pairs, where the keys correspond to the `_id` of the attributes defined in the collection, and the values represent the actual data for that attribute.

### Example Items

```json
[
  {
    "i": "101845",
    "values": {
      "de54b737-1c8f-4ef2-bfea-d6b01cf3b92f": "Yellow",
      "aa4f8726-1265-46e6-9b2b-5ebbd26bd562": 12.33,
      "ff8ff854-da72-455c-8936-466cb61c398a": "S",
      "3fcf2612-2586-49c7-ad3e-6413ebf7436e": 2,
      "eeb3ce29-ca66-4b93-bb95-8e7d7b96c798": true
    }
  },
  {
    "i": "101847",
    "values": {
      "de54b737-1c8f-4ef2-bfea-d6b01cf3b92f": "Blue",
      "aa4f8726-1265-46e6-9b2b-5ebbd26bd562": 10.99,
      "ff8ff854-da72-455c-8936-466cb61c398a": "M",
      "3fcf2612-2586-49c7-ad3e-6413ebf7436e": 1,
      "eeb3ce29-ca66-4b93-bb95-8e7d7b96c798": true
    }
  },
  {
    "i": "101848",
    "values": {
      "de54b737-1c8f-4ef2-bfea-d6b01cf3b92f": "Grey",
      "aa4f8726-1265-46e6-9b2b-5ebbd26bd562": 8.95,
      "ff8ff854-da72-455c-8936-466cb61c398a": "XL",
      "3fcf2612-2586-49c7-ad3e-6413ebf7436e": 2,
      "eeb3ce29-ca66-4b93-bb95-8e7d7b96c798": false
    }
  }
]
```

## TSV Presentation of the Collection Values

The 'description' is used to make this file more readable. It is the dr3 basic description of a product but is not used nor needed for collection values. 

```tsv
id	description	Color	Price	Size	Length (m)	Available
101845	DOPSLEUTEL 1/2" 13 MM 6-KANT - 19 13	Yellow	12.33	S	2	1
101847	DOPSLEUTEL 1/2" 17 MM 6-KANT - 19 17	Blue	10.99	M	1	1
101848	DOPSLEUTEL 1/2" 19 MM 6-KANT - 19 19	Grey	8.95	XL	2	0
```
