openapi: 3.0.0
info:
  title: Pajoohyar
  description: Pajoohyar Online Library Api's
  version: 1.0.0
paths:
  /documents/search:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                mine:
                  example: 1
                  type: boolean
                  description: search allowed documents for the user
                trash:
                  example: 1
                  type: boolean
                title:
                  type: string
                  example: books
                collection_id:
                  type: integer
                  example: 1
                status:
                  type: integer
                  example: 1,2,3
                  description: 1:draft - 2:published - 3:inactive
                document_id:
                  type: integer
                  example:
                link:
                  type: string
                  example: pathFile/fileName.fileExt
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: operation was successful
                  ok:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Document"
                  meta:
                    type: object
                    properties:
                      total:
                        type: integer
                        example: 1
                      current_page:
                        type: integer
                        example: 1
                      per_page:
                        type: integer
                        example: 10
components:
  schemas:
    Document:
      properties:
        id:
          type: integer
          example: 1
        notes_count:
          type: integer
          example: 0
        item_schema:
          type: object
          properties:
            id:
              type: integer
              example: 10
            title_fa:
              type: string
              example: برنامه رادیویی
            title_en:
              type: string
              example: Radio Program
            csl_slug:
              type: string
              example: broadcast
            icon:
              type: string
              example: files/items/icon.jpg
            status:
              type: integer
              example: 1
            schema:
              type: array
              items:
                properties:
                  name:
                    type: string
                    example: creators
                  title:
                    type: object
                    properties:
                      fa:
                        type: string
                        example: پدید آورندگان
                      en:
                        type: string
                        example: creators
                  required:
                    type: boolean
                    example: false
                  main_info:
                    type: boolean
                    example: true
                  positions:
                    type: array
                    items:
                      properties:
                        name:
                          type: string
                          example: author
                        title:
                          type: object
                          properties:
                            fa:
                              type: string
                              example: نویسنده
                            en:
                              type: string
                              example: producer
            created_at:
              $ref: "#/components/schemas/TimeEntity"
            updated_at:
              $ref: "#/components/schemas/TimeEntity"
        status:
          type: object
          properties:
            text:
              type: string
              example: پیش نویس
            code:
              type: integer
              example: 1
        creators:
          type: array
          items:
            type: string
        tags:
          type: array
          items:
            type: string
        language:
          type: string
          example: fa
        title:
          type: string
          example: First Document
        is_deleted:
          type: boolean
          example: false
        collection:
          $ref: "#/components/schemas/Collection"
        created_at:
          $ref: "#/components/schemas/TimeEntity"
        updated_at:
          $ref: "#/components/schemas/TimeEntity"
    Collection:
      type: object
      properties:
        id:
          type: integer
          example: 2
        title:
          type: string
          example: Second Collection
        policies:
          type: object
          properties:
            updated:
              type: boolean
              example: true
            delete:
              type: boolean
              example: true
            kick_member:
              type: boolean
              example: true
            change_permission:
              type: boolean
              example: true
        parent:
          type: object
          properties:
            id:
              type: integer
              example: 1
            title:
              type: string
              example: First Collection
            created_at:
              $ref: "#/components/schemas/TimeEntity"
            updated_at:
              $ref: "#/components/schemas/TimeEntity"
        children_count:
          type: integer
          example: 0
        tags:
          type: array
          items:
            type: string
        status:
          type: object
          properties:
            text:
              type: string
              example: دستنویس
            code:
              type: integer
              example: 1
        icon_pic_urls:
          $ref: "#/components/schemas/Picture"
        cover_pic_urls:
          $ref: "#/components/schemas/Picture"
        description:
          type: string
          example: ""
        privacy:
          type: object
          properties:
            text:
              type: string
              example: آزاد
            code:
              type: integer
              example: 1
        duplicates:
          example: []
        is_deleted:
          type: boolean
          example: false
        created_at:
          $ref: "#/components/schemas/TimeEntity"
        updated_at:
          $ref: "#/components/schemas/TimeEntity"
    Picture:
      type: object
      properties:
        lg:
          type: string
          example: /api/third-party/image?path=null-item.png&w=512&h=512
        md:
          type: string
          example: /api/third-party/image?path=null-item.png&w=256&h=256
        sm:
          type: string
          example: /api/third-party/image?path=null-item.png&w=128&h=128
    TimeEntity:
      type: object
      properties:
        year:
          type: integer
          example: 1400
        month:
          type: integer
          example: 1
        day:
          type: integer
          example: 1
        dayOfWeek:
          type: integer
          example: 1
        dayOfYear:
          type: integer
          example: 1
        hour:
          type: integer
          example: 12
        minute:
          type: integer
          example: 30
        second:
          type: integer
          example: 0
        micro:
          type: integer
          example: 0
        timestamp:
          type: string
          example: 1552099415
        formatted:
          type: object
        timezone:
          type: object
          properties:
            timezone_type:
              type: integer
              example: 3
            timezone:
              type: string
              example: Asia/Tehran
        ago_str:
          type: string
          example: 1 سال پیش
