swagger: '2.0'
info:
  title: Documents API
  description: Endpoints for documents, categories, privacy levels, and versions.
  version: v1
host: eboard.devsgraphics.com
schemes:
- https
basePath: /api/v1/documents
consumes:
- application/json
produces:
- application/json
securityDefinitions:
  Basic:
    type: basic
security:
- Basic: []
paths:
  /categories/:
    get:
      operationId: categories_list
      description: ''
      parameters:
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      - name: page_size
        in: query
        description: Number of results to return per page.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/DocumentCategory'
      tags:
      - categories
    post:
      operationId: categories_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentCategory'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/DocumentCategory'
      tags:
      - categories
    parameters: []
  /categories/{id}/:
    get:
      operationId: categories_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentCategory'
      tags:
      - categories
    put:
      operationId: categories_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentCategory'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentCategory'
      tags:
      - categories
    patch:
      operationId: categories_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentCategory'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentCategory'
      tags:
      - categories
    delete:
      operationId: categories_delete
      description: ''
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - categories
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this Document Category.
      required: true
      type: integer
  /documents/:
    get:
      operationId: documents_list
      description: ''
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      - name: page_size
        in: query
        description: Number of results to return per page.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/Document'
      tags:
      - documents
    post:
      operationId: documents_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentCreateUpdate'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/DocumentCreateUpdate'
      tags:
      - documents
    parameters: []
  /documents/{id}/:
    get:
      operationId: documents_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Document'
      tags:
      - documents
    put:
      operationId: documents_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentCreateUpdate'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentCreateUpdate'
      tags:
      - documents
    patch:
      operationId: documents_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentCreateUpdate'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentCreateUpdate'
      tags:
      - documents
    delete:
      operationId: documents_delete
      description: ''
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - documents
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this Document.
      required: true
      type: string
      format: uuid
  /documents/{id}/preview/:
    get:
      operationId: documents_preview
      summary: Stream the current_file in a way that can be embedded in an iframe.
      description: |-
        - Uses Content-Disposition: inline so PDFs render in-browser.
        - @xframe_options_exempt ensures Django doesn't add X-Frame-Options: SAMEORIGIN.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Document'
      tags:
      - documents
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this Document.
      required: true
      type: string
      format: uuid
  /documents/{id}/versions/:
    get:
      operationId: documents_versions
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Document'
      tags:
      - documents
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this Document.
      required: true
      type: string
      format: uuid
  /privacy-levels/:
    get:
      operationId: privacy-levels_list
      description: ''
      parameters:
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      - name: page_size
        in: query
        description: Number of results to return per page.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/DocumentPrivacyLevel'
      tags:
      - privacy-levels
    post:
      operationId: privacy-levels_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentPrivacyLevel'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/DocumentPrivacyLevel'
      tags:
      - privacy-levels
    parameters: []
  /privacy-levels/{id}/:
    get:
      operationId: privacy-levels_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentPrivacyLevel'
      tags:
      - privacy-levels
    put:
      operationId: privacy-levels_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentPrivacyLevel'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentPrivacyLevel'
      tags:
      - privacy-levels
    patch:
      operationId: privacy-levels_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/DocumentPrivacyLevel'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentPrivacyLevel'
      tags:
      - privacy-levels
    delete:
      operationId: privacy-levels_delete
      description: ''
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - privacy-levels
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this Document Privacy Level.
      required: true
      type: integer
  /versions/:
    get:
      operationId: versions_list
      description: 'Read-only: versions are created automatically when a Document
        is saved.'
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      - name: page_size
        in: query
        description: Number of results to return per page.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/DocumentVersion'
      tags:
      - versions
    parameters: []
  /versions/{id}/:
    get:
      operationId: versions_read
      description: 'Read-only: versions are created automatically when a Document
        is saved.'
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/DocumentVersion'
      tags:
      - versions
    parameters:
    - name: id
      in: path
      description: A UUID string identifying this Document Version.
      required: true
      type: string
      format: uuid
definitions:
  DocumentCategory:
    required:
    - name
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 100
        minLength: 1
      description:
        title: Description
        type: string
      is_active:
        title: Is active
        type: boolean
  Document:
    required:
    - org
    - title
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      org:
        title: Org
        type: integer
      org_name:
        title: Org name
        type: string
        readOnly: true
        minLength: 1
      board:
        title: Board
        description: 'Optional: document can be board-specific or org-wide'
        type: integer
        x-nullable: true
      board_name:
        title: Board name
        type: string
        readOnly: true
        minLength: 1
      title:
        title: Title
        type: string
        maxLength: 255
        minLength: 1
      description:
        title: Description
        type: string
      category:
        title: Category
        type: integer
        x-nullable: true
      category_name:
        title: Category name
        type: string
        readOnly: true
        minLength: 1
      privacy_level:
        title: Privacy level
        type: integer
        x-nullable: true
      privacy_label:
        title: Privacy label
        type: string
        readOnly: true
        minLength: 1
      current_file:
        title: Current file
        description: Points to the latest uploaded version of this document
        type: string
        readOnly: true
        x-nullable: true
        format: uri
      file_url:
        title: File url
        type: string
        readOnly: true
      version_number:
        title: Version number
        type: integer
        readOnly: true
      uploaded_by:
        title: Uploaded by
        type: integer
        readOnly: true
        x-nullable: true
      uploaded_by_email:
        title: Uploaded by email
        type: string
        format: email
        readOnly: true
        minLength: 1
      updated_by:
        title: Updated by
        type: integer
        readOnly: true
        x-nullable: true
      updated_by_email:
        title: Updated by email
        type: string
        format: email
        readOnly: true
        minLength: 1
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      updated_at:
        title: Updated at
        type: string
        format: date-time
        readOnly: true
      preview_url:
        title: Preview url
        type: string
        readOnly: true
  DocumentCreateUpdate:
    required:
    - org
    - title
    type: object
    properties:
      org:
        title: Org
        type: integer
      board:
        title: Board
        description: 'Optional: document can be board-specific or org-wide'
        type: integer
        x-nullable: true
      title:
        title: Title
        type: string
        maxLength: 255
        minLength: 1
      description:
        title: Description
        type: string
      category:
        title: Category
        type: integer
        x-nullable: true
      privacy_level:
        title: Privacy level
        type: integer
        x-nullable: true
      current_file:
        title: Current file
        description: Points to the latest uploaded version of this document
        type: string
        readOnly: true
        x-nullable: true
        format: uri
  DocumentPrivacyLevel:
    required:
    - key
    - label
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      key:
        title: Key
        description: System key for the privacy level (e.g., PUBLIC, BOARD_ONLY, ADMIN_ONLY)
        type: string
        maxLength: 50
        minLength: 1
      label:
        title: Label
        description: Human-friendly label (e.g., Public, Board Members Only, Admins
          Only)
        type: string
        maxLength: 100
        minLength: 1
      description:
        title: Description
        type: string
      is_active:
        title: Is active
        type: boolean
  DocumentVersion:
    required:
    - document
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      document:
        title: Document
        type: string
        format: uuid
      version_number:
        title: Version number
        type: integer
        readOnly: true
      file:
        title: File
        description: Uploaded file for this document version
        type: string
        readOnly: true
        format: uri
      file_url:
        title: File url
        type: string
        readOnly: true
      uploaded_by:
        title: Uploaded by
        type: integer
        readOnly: true
        x-nullable: true
      uploaded_by_email:
        title: Uploaded by email
        type: string
        format: email
        readOnly: true
        minLength: 1
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
