openapi: 3.1.0
info:
  title: StrafesNET Submissions - OpenAPI 3.1
  description: Browse and manage map submissions in the staging pipeline.
  version: 0.1.0
servers:
  - url: https://submissions.strafes.net/v1
tags:
  - name: Submissions
    description: Submission operations
paths:
# status
# 	submit
# 	accept
# 	publish
# complete
  /submissions:
    get:
      summary: Get list of submissions
      operationId: listSubmissions
      tags:
        - Submissions
      parameters:
        - name: page
          in: query
          required: true
          schema:
            $ref: "#/components/schemas/Pagination"
        - name: filter
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/SubmissionFilter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Submission"
        default:
          description: General Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    post:
      summary: Create new submission
      operationId: createSubmission
      tags:
        - Submissions
# how to do this? body should have the submission in json or something
#      content:
#        application/json:
#          schema:
#           	$ref: "#/components/schemas/SubmissionCreate"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Submission"
        default:
          description: General Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /submissions/{SubmissionID}:
    get:
      summary: Retrieve map with ID
      operationId: getSubmission
      tags:
        - Submissions
      parameters:
        - name: SubmissionID
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Submission"
        default:
          description: General Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /submissions/{SubmissionID}/model:
    patch:
      summary: Update model following role restrictions
      operationId: patchSubmissionModel
      tags:
        - Submissions
      parameters:
        - name: SubmissionID
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: ModelID
          in: query
          required: true
          schema:
            type: integer
            format: int64
        - name: VersionID
          in: query
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Successful response
        default:
          description: General Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /submissions/{SubmissionID}/completed:
    patch:
      summary: Retrieve map with ID
      operationId: patchSubmissionCompleted
      tags:
        - Submissions
      parameters:
        - name: SubmissionID
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: Completed
          in: query
          required: true
          schema:
            type: boolean
      responses:
        "200":
          description: Successful response
        default:
          description: General Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /submissions/{SubmissionID}/status:
    patch:
      summary: Update status following role restrictions
      operationId: patchSubmissionStatus
      tags:
        - Submissions
      parameters:
        - name: SubmissionID
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: Status
          in: query
          required: true
          schema:
            type: integer
            format: int32
      responses:
        "200":
          description: Successful response
        default:
          description: General Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    User:
      type: object
      properties:
        ID:
          type: integer
          format: int64
        Username:
          type: string
        StateID:
          type: integer
          format: int32
    Submission:
      type: object
      properties:
        ID:
          type: integer
          format: int64
        DisplayName:
          type: string
        Creator:
          type: string
        GameID:
          type: integer
          format: int32
        Date:
          type: integer
          format: int64
    SubmissionFilter:
      type: object
      properties:
        ID:
          type: integer
          format: int64
        DisplayName:
          type: string
        Creator:
          type: string
        GameID:
          type: integer
          format: int32
        Date:
          type: integer
          format: int64
    Pagination:
      type: object
      required:
        - Page
        - Limit
      properties:
        Page:
          type: integer
          format: int32
          minimum: 1
        Limit:
          type: integer
          format: int32
          minimum: 1
          maximum: 100
    Error:
      description: Represents error object
      type: object
      properties:
        code:
          type: integer
          format: int64
        message:
          type: string
      required:
        - code
        - message