# Schema: ProjectStorageModel
---
type: object
required:
  - _type
  - id
  - projectFolderMode
  - createdAt
  - updatedAt
properties:
  _type:
    type: string
    enum:
      - ProjectStorage
  id:
    type: integer
    description: The project storage's id
    minimum: 1
  projectFolderMode:
    type: string
    enum:
      - inactive
      - manual
  createdAt:
    type: string
    format: date-time
    description: Time of creation
  updatedAt:
    type: string
    format: date-time
    description: Time of the most recent change to the project storage
  _links:
    type: object
    required:
      - self
      - creator
      - storage
      - project
    properties:
      self:
        allOf:
          - $ref: './link.yml'
          - description: |-
              This project storage.

              **Resource**: ProjectStorage
      creator:
        allOf:
          - $ref: './link.yml'
          - description: |-
              The user who created the project storage.

              **Resource**: User
      storage:
        allOf:
          - $ref: './link.yml'
          - description: |-
              The storage resource, that is linked to a project with this project storage.

              **Resource**: Storage
      project:
        allOf:
          - $ref: './link.yml'
          - description: |-
              The project resource, that is linked to a storage with this project storage.

              **Resource**: Project
      projectFolder:
        allOf:
          - $ref: './link.yml'
          - description: |-
              The directory on the storage that is used as a project folder.

              **Resource**: StorageFile

              # Conditions

              Only provided, if the `projectFolderMode` is `manual` or `automatic`.
      open:
        allOf:
          - $ref: './link.yml'
          - description: |-
              A link to OpenProject strorage.
      openWithConnectionEnsured:
        allOf:
          - $ref: './link.yml'
          - description: |-
              A link to OpenProject storage with making sure user has access to it.

              # Conditions

              If the storage has not been configured(oauth client is missing, for instance), then the link is null.
example:
  _type: 'ProjectStorage'
  id: 1337
  projectFolderMode: 'manual'
  createdAt: '2023-01-20T14:30:00.368Z'
  updatedAt: '2023-05-23T11:57:48.618Z'
  _links:
    self:
      href: '/api/v3/project_storages/23'
    projectFolder:
      href: '/api/v3/storages/81/files/30'
    creator:
      title: 'Darth Vader'
      href: '/api/v3/users/3'
    project:
      title: 'Death Star 3.0'
      href: '/api/v3/projects/11'
    storage:
      title: "Palpatine's Data Vault"
      href: '/api/v3/storages/81'
    open:
      href: '/api/v3/storages/81/open'
    openWithConnectionEnsured:
      href: '/oauth_clients/123/ensure_connection?destination_url=https%3A%2F%2Fopenproject.local%2Fprojects%2Fdeath-star%2Fproject_storages%2F23%2Fopen&storage_id=81'
