swagger: '2.0'
info:
  title: Smart Inspect API
  description: API 文档 (Swagger UI)
  version: v1
host: 127.0.0.1:8000
schemes:
- http
basePath: /api
consumes:
- application/json
produces:
- application/json
securityDefinitions:
  Bearer:
    type: apiKey
    name: Authorization
    in: header
    description: 'JWT Bearer token. Example: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...'
security:
- Bearer: []
paths:
  /devices/:
    get:
      operationId: devices_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/Device'
      tags:
      - devices
    post:
      operationId: devices_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/Device'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/Device'
      tags:
      - devices
    parameters: []
  /devices/{id}/:
    get:
      operationId: devices_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Device'
      tags:
      - devices
    put:
      operationId: devices_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/Device'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Device'
      tags:
      - devices
    patch:
      operationId: devices_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/Device'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Device'
      tags:
      - devices
    delete:
      operationId: devices_delete
      description: ''
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - devices
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this device.
      required: true
      type: integer
  /items/:
    get:
      operationId: items_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/CheckItem'
      tags:
      - items
    post:
      operationId: items_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckItem'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CheckItem'
      tags:
      - items
    parameters: []
  /items/{id}/:
    get:
      operationId: items_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckItem'
      tags:
      - items
    put:
      operationId: items_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckItem'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckItem'
      tags:
      - items
    patch:
      operationId: items_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckItem'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckItem'
      tags:
      - items
    delete:
      operationId: items_delete
      description: ''
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - items
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this check item.
      required: true
      type: integer
  /plans/:
    get:
      operationId: plans_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/CheckPlan'
      tags:
      - plans
    post:
      operationId: plans_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckPlan'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CheckPlan'
      tags:
      - plans
    parameters: []
  /plans/{id}/:
    get:
      operationId: plans_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckPlan'
      tags:
      - plans
    put:
      operationId: plans_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckPlan'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckPlan'
      tags:
      - plans
    patch:
      operationId: plans_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckPlan'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckPlan'
      tags:
      - plans
    delete:
      operationId: plans_delete
      description: ''
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - plans
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this check plan.
      required: true
      type: integer
  /records/:
    get:
      operationId: records_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/CheckRecord'
      tags:
      - records
    post:
      operationId: records_create
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckRecord'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/CheckRecord'
      tags:
      - records
    parameters: []
  /records/{id}/:
    get:
      operationId: records_read
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckRecord'
      tags:
      - records
    put:
      operationId: records_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckRecord'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckRecord'
      tags:
      - records
    patch:
      operationId: records_partial_update
      description: ''
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/CheckRecord'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/CheckRecord'
      tags:
      - records
    delete:
      operationId: records_delete
      description: ''
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - records
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this check record.
      required: true
      type: integer
  /token/:
    post:
      operationId: token_create
      description: |-
        Takes a set of user credentials and returns an access and refresh JSON web
        token pair to prove the authentication of those credentials.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/TokenObtainPair'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/TokenObtainPair'
      tags:
      - token
    parameters: []
  /token/refresh/:
    post:
      operationId: token_refresh_create
      description: |-
        Takes a refresh type JSON web token and returns an access type JSON web
        token if the refresh token is valid.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/TokenRefresh'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/TokenRefresh'
      tags:
      - token
    parameters: []
definitions:
  CheckItem:
    required:
    - name
    - device
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 200
        minLength: 1
      description:
        title: Description
        type: string
      expected_value:
        title: Expected value
        type: string
        maxLength: 200
      device:
        title: Device
        type: integer
  Device:
    required:
    - name
    - code
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      check_items:
        type: array
        items:
          $ref: '#/definitions/CheckItem'
        readOnly: true
      created_at:
        title: Created at
        type: string
        format: date-time
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 200
        minLength: 1
      code:
        title: Code
        type: string
        maxLength: 100
        minLength: 1
      location:
        title: Location
        type: string
        maxLength: 200
      group:
        title: Group
        type: string
        maxLength: 100
  CheckPlan:
    required:
    - devices
    - name
    - frequency
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      devices:
        type: array
        items:
          type: integer
        uniqueItems: true
      name:
        title: Name
        type: string
        maxLength: 200
        minLength: 1
      frequency:
        title: Frequency
        type: string
        enum:
        - daily
        - weekly
        - monthly
      active:
        title: Active
        type: boolean
  CheckRecord:
    required:
    - status
    - device
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      status:
        title: Status
        type: string
        enum:
        - ok
        - warn
        - fail
      value:
        title: Value
        type: string
        maxLength: 200
      note:
        title: Note
        type: string
      photo:
        title: Photo
        type: string
        readOnly: true
        x-nullable: true
        format: uri
      attachment:
        title: Attachment
        type: string
        readOnly: true
        x-nullable: true
        format: uri
      checked_at:
        title: Checked at
        type: string
        format: date-time
        readOnly: true
      checked_by:
        title: Checked by
        type: string
        maxLength: 150
      plan:
        title: Plan
        type: integer
        x-nullable: true
      device:
        title: Device
        type: integer
      item:
        title: Item
        type: integer
        x-nullable: true
  TokenObtainPair:
    required:
    - username
    - password
    type: object
    properties:
      username:
        title: Username
        type: string
        minLength: 1
      password:
        title: Password
        type: string
        minLength: 1
  TokenRefresh:
    required:
    - refresh
    type: object
    properties:
      refresh:
        title: Refresh
        type: string
        minLength: 1
      access:
        title: Access
        type: string
        readOnly: true
        minLength: 1
