# Introduction

## Resource model

A resource is an entity that has a file attached to it. It comprises of a name, details (listed above) and a custom attribute list that matches its resource type attributes.
As an admin, one can list, accept and reject resources submitted by users.

### Example

```json
{
    "id": 15,
    "resource_type": "Some resource type",
    "store_id": 3,
    "member_id": 33,
    "user_id": "some-user-uuid",
    "name": "a very important document",
    "marketing_usable": true,
    "file_url": "https://some.file/url",
    "state": "accepted",
    "properties": {
      "campaign_name": ["November", "October"],
      "used_so_far": false,
      "author_count": 3
    },
    "campaign_type": "some campaign type",
    "notes": "some notes about the resource",
    "created_at": "2020-12-30T17:12:46.435Z",
    "updated_at": "2020-12-30T17:12:50.235Z",
}
```

### Definition

Key | Type     | Optional | Description
--------- |----------| --------- | ---------
id | integer  | no |
resource_type | string   | no | name of the ResourceType the resource is assigned to
store_id | integer  | no | .id of the Store the resource is assigned to
member_id | integer  | no | .member_id of the User the resource has been created by
user_id | string   | no | uuid of the User the resource has been created by
name | string   | no | name of the resource
marketing_usable | boolean  | no | whether the resource will be allowed to be used for marketing purposes
file_url | string   | no | URL of the file where the resource is located at
state | string   | no | current state of the resource (could be `pending` (the default one), `accepted` or `rejected`)
properties | object   | yes | custom attributes of the resource
campaign_type | string   | yes | campaign type of the resource
notes | string   | yes | notes about the resource - used to provide a reason for its acceptance/rejection/resubmission
created_at | datetime | no | time of creation
updated_at | datetime | no | time of last update