---
openapi: 3.1.0
components:
  schemas:
    AnnounceRequest:
      type: object
      required:
      - fileName
      - contentType
      - sizeBytes
      properties:
        fileName:
          type: string
          examples:
          - Rechnung.pdf
          pattern: \S
          maxLength: 1024
        contentType:
          type: string
          examples:
          - application/pdf
          maxLength: 255
        sizeBytes:
          type: integer
          format: int64
          examples:
          - 48213
          minimum: 1
        thumbnailSizeBytes:
          type:
          - integer
          - "null"
          format: int64
          examples:
          - 6120
    AttachmentResponse:
      type: object
      required:
      - id
      - fileName
      - contentType
      - sizeBytes
      - thumbnail
      properties:
        id:
          type: integer
          format: int64
          examples:
          - 7
        fileName:
          type: string
          examples:
          - Rechnung.pdf
          maxLength: 255
        contentType:
          type: string
          examples:
          - application/pdf
          maxLength: 255
        sizeBytes:
          type: integer
          format: int64
          examples:
          - 48213
        thumbnail:
          type: boolean
          examples:
          - false
    AuthProviderResponse:
      required:
      - id
      - label
      - available
      - loginUrl
      - issuer
      type: object
      properties:
        id:
          type: string
          examples:
          - google
          maxLength: 64
        label:
          type: string
          examples:
          - Google
          maxLength: 100
        available:
          type: boolean
        loginUrl:
          type:
          - string
          - "null"
          examples:
          - /api/auth/login
          maxLength: 2048
        issuer:
          type: string
          examples:
          - https://accounts.google.com
          maxLength: 2048
    AuthProvidersResponse:
      required:
      - enabled
      - providers
      type: object
      properties:
        enabled:
          type: boolean
        providers:
          type: array
          items:
            $ref: "#/components/schemas/AuthProviderResponse"
    CurrentUserResponse:
      type: object
      required:
      - email
      properties:
        email:
          type: string
          format: email
          examples:
          - person@example.com
          maxLength: 254
        name:
          type:
          - string
          - "null"
          examples:
          - Person Example
          maxLength: 255
        pictureUrl:
          type:
          - string
          - "null"
          examples:
          - https://example.com/avatar.jpg
          maxLength: 2048
    Instant:
      type: string
      format: date-time
      examples:
      - 2022-03-10T16:15:50Z
    LinkResponse:
      type: object
      required:
      - url
      - expiresAt
      properties:
        url:
          type: string
          maxLength: 4096
        expiresAt:
          $ref: "#/components/schemas/Instant"
    LocalDate:
      type: string
      format: date
    RefusalResponse:
      type: object
      required:
      - refusal
      properties:
        refusal:
          type: string
          examples:
          - TASK_FULL
          enum:
          - UNSUPPORTED_TYPE
          - EMPTY
          - TOO_LARGE
          - TASK_FULL
          - USER_FULL
          - MISMATCH
    TaskCreateRequest:
      type: object
      required:
      - description
      - dueDate
      - importance
      - state
      properties:
        description:
          type: string
          examples:
          - Renew the passport
          pattern: \S
          maxLength: 255
        dueDate:
          type: string
          examples:
          - 2026-11-30
          $ref: "#/components/schemas/LocalDate"
        importance:
          type: string
          examples:
          - HIGH
          $ref: "#/components/schemas/TaskImportance"
        state:
          type: string
          examples:
          - TODO
          $ref: "#/components/schemas/TaskState"
        attachmentIds:
          type:
          - array
          - "null"
          items:
            type: integer
            format: int64
          description: "Attachments of a task deleted moments ago, for an undo to\
            \ bring back (#204); only the caller's, only within the undo window."
          maxItems: 10
    TaskImportance:
      type: string
      enum:
      - LOW
      - MEDIUM
      - HIGH
    TaskResponse:
      type: object
      required:
      - id
      - description
      - dueDate
      - importance
      - state
      properties:
        id:
          type: integer
          format: int64
          examples:
          - 42
        description:
          type: string
          examples:
          - Renew the passport
          maxLength: 255
        dueDate:
          type: string
          examples:
          - 2026-11-30
          $ref: "#/components/schemas/LocalDate"
        importance:
          type: string
          examples:
          - HIGH
          $ref: "#/components/schemas/TaskImportance"
        state:
          type: string
          examples:
          - TODO
          $ref: "#/components/schemas/TaskState"
        attachments:
          type: array
          items:
            $ref: "#/components/schemas/AttachmentResponse"
          description: Its available attachments (#204). Always sent; optional in
            the schema so the board still validates a task from a backend rolled back
            to before attachments.
    TaskState:
      type: string
      enum:
      - TODO
      - WORKING
      - DONE
    TaskUpdateRequest:
      type: object
      required:
      - description
      - dueDate
      - importance
      - state
      properties:
        description:
          type: string
          examples:
          - Renew the passport
          pattern: \S
          maxLength: 255
        dueDate:
          type: string
          examples:
          - 2026-11-30
          $ref: "#/components/schemas/LocalDate"
        importance:
          type: string
          examples:
          - HIGH
          $ref: "#/components/schemas/TaskImportance"
        state:
          type: string
          examples:
          - TODO
          $ref: "#/components/schemas/TaskState"
    ThumbnailUploadResponse:
      type: object
      required:
      - url
      - headers
      properties:
        url:
          type: string
          maxLength: 4096
        headers:
          type: object
          additionalProperties:
            type: string
    UploadResponse:
      type: object
      required:
      - attachment
      - url
      - headers
      - expiresAt
      properties:
        attachment:
          $ref: "#/components/schemas/AttachmentResponse"
        url:
          type: string
          maxLength: 4096
        headers:
          type: object
          additionalProperties:
            type: string
        expiresAt:
          $ref: "#/components/schemas/Instant"
        thumbnailUpload:
          $ref: "#/components/schemas/ThumbnailUploadResponse"
    VersionResponse:
      type: object
      required:
      - version
      - minimumAppVersion
      properties:
        version:
          type: string
          examples:
          - 0.11.0
          maxLength: 64
        minimumAppVersion:
          type: string
          examples:
          - 1.0.0
          maxLength: 64
  securitySchemes:
    SecurityScheme:
      type: openIdConnect
      openIdConnectUrl: https://accounts.google.com/.well-known/openid-configuration
      description: Authentication
tags:
- name: Account
  description: The signed-in user's own account.
- name: Attachments
  description: "Files on a task, transferred directly between the browser and storage."
- name: Authentication
  description: "The browser side of sign-in, sign-out, and the current session."
- name: Deployment
  description: "What a deployment runs, for the tooling that deploys it."
- name: Tasks
  description: Everything a signed-in user can do to their own tasks.
paths:
  /api/account:
    delete:
      summary: Delete my account
      description: "Deletes every task and every file of the caller, and the account\
        \ itself. It cannot be undone."
      tags:
      - Account
      responses:
        "204":
          description: "Deleted, and this browser's session ended."
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/auth/login:
    get:
      summary: Start or complete sign-in
      description: "Being @Authenticated is the whole point: an unauthenticated request\
        \ is intercepted by the OIDC authorization code flow before this method ever\
        \ runs."
      tags:
      - Authentication
      responses:
        "303":
          description: Sign-in succeeded; redirects to the post-login URI.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/auth/login/{provider}:
    get:
      summary: Start or complete sign-in with one provider
      description: "For every provider but the deployment's main one, which uses /api/auth/login.\
        \ The provider list names each provider's path."
      tags:
      - Authentication
      parameters:
      - name: provider
        in: path
        required: true
        schema:
          type: string
          maxLength: 64
      responses:
        "303":
          description: Sign-in succeeded; redirects to the post-login URI.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/auth/logout:
    get:
      summary: End the local session
      description: Expires every session cookie the browser sent; the identity provider's
        own session is untouched.
      tags:
      - Authentication
      responses:
        "303":
          description: Signed out; redirects to the post-login URI.
  /api/auth/me:
    get:
      summary: The signed-in identity
      description: The only identity the frontend is allowed to know about.
      tags:
      - Authentication
      responses:
        "200":
          description: The signed-in user.
          content:
            application/json:
              examples:
                currentUser:
                  value:
                    email: person@example.com
                    name: Person Example
                    pictureUrl: https://example.com/avatar.jpg
              schema:
                $ref: "#/components/schemas/CurrentUserResponse"
        "401":
          description: No one is signed in.
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/auth/providers:
    get:
      summary: List the configured sign-in providers
      description: "Every provider this deployment declares, usable or not, needing\
        \ no authentication to ask."
      tags:
      - Authentication
      responses:
        "200":
          description: The configured providers.
          content:
            application/json:
              examples:
                providers:
                  value:
                    enabled: true
                    providers:
                    - id: google
                      label: Google
                      available: true
                      loginUrl: /api/auth/login
                      issuer: https://accounts.google.com
              schema:
                $ref: "#/components/schemas/AuthProvidersResponse"
  /api/tasks:
    get:
      summary: List the caller's tasks
      description: "Ordered by due date, then by importance, high first, then id."
      tags:
      - Tasks
      responses:
        "200":
          description: The caller's tasks.
          content:
            application/json:
              examples:
                tasks:
                  value:
                  - id: 42
                    description: Renew the passport
                    dueDate: 2026-11-30
                    importance: HIGH
                    state: TODO
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/TaskResponse"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
    post:
      summary: Create a task
      description: The caller becomes the owner; the id cannot be set.
      tags:
      - Tasks
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TaskCreateRequest"
        required: true
      responses:
        "201":
          description: The task as created.
          content:
            application/json:
              examples:
                task:
                  value:
                    id: 42
                    description: Renew the passport
                    dueDate: 2026-11-30
                    importance: HIGH
                    state: TODO
              schema:
                $ref: "#/components/schemas/TaskResponse"
        "400":
          description: "A field failed validation, for example a blank description\
            \ or a due date in the past."
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/tasks/{id}:
    put:
      summary: Replace a task
      description: Replaces every field of a task owned by the caller.
      tags:
      - Tasks
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TaskUpdateRequest"
        required: true
      responses:
        "200":
          description: The task as updated.
          content:
            application/json:
              examples:
                task:
                  value:
                    id: 42
                    description: Renew the passport
                    dueDate: 2026-11-30
                    importance: HIGH
                    state: TODO
              schema:
                $ref: "#/components/schemas/TaskResponse"
        "400":
          description: A field failed validation.
        "404":
          description: No task with this id is owned by the caller.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
    delete:
      summary: Delete a task
      tags:
      - Tasks
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "204":
          description: The task was deleted.
        "404":
          description: No task with this id is owned by the caller.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/tasks/{taskId}/attachments:
    post:
      summary: Announce an upload
      description: "Checks the type and the limits, and answers with a link that accepts\
        \ exactly this file: PUT it there with the given headers, then confirm."
      tags:
      - Attachments
      parameters:
      - name: taskId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AnnounceRequest"
        required: true
      responses:
        "201":
          description: "The attachment, pending, and its upload link."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UploadResponse"
        "422":
          description: "Refused: an unsupported type, too large, or a limit reached."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefusalResponse"
        "404":
          description: No task with this id is owned by the caller.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
        "400":
          description: Bad Request
      security:
      - SecurityScheme: []
  /api/tasks/{taskId}/attachments/{id}:
    delete:
      summary: Remove an attachment
      description: Deletes the file and its record.
      tags:
      - Attachments
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
          format: int64
      - name: taskId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "204":
          description: Removed.
        "404":
          description: No such attachment on a task the caller owns.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/tasks/{taskId}/attachments/{id}/confirm:
    post:
      summary: Confirm an upload
      description: Checks the file arrived as announced and makes the attachment available.
      tags:
      - Attachments
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
          format: int64
      - name: taskId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: "The attachment, available."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AttachmentResponse"
        "409":
          description: The file has not arrived yet.
        "422":
          description: What arrived is not what was announced; it was deleted.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefusalResponse"
        "404":
          description: No such attachment on a task the caller owns.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/tasks/{taskId}/attachments/{id}/link:
    get:
      summary: A link to open the file
      description: "For the owner's browser to fetch the file straight from storage.\
        \ The same link is handed out again while it is fresh, and the answer may\
        \ be kept for as long as that, so the browser's cache keeps the file."
      tags:
      - Attachments
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
          format: int64
      - name: taskId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: The link and until when it works.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LinkResponse"
        "404":
          description: No such available attachment on a task the caller owns.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/tasks/{taskId}/attachments/{id}/thumbnail-link:
    get:
      summary: A link to the preview thumbnail
      description: "Like the file's link, for the small preview an image's row shows\
        \ (#236)."
      tags:
      - Attachments
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
          format: int64
      - name: taskId
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: The link and until when it works.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LinkResponse"
        "404":
          description: No such available attachment with a thumbnail on a task the
            caller owns.
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      security:
      - SecurityScheme: []
  /api/version:
    get:
      summary: Report the running release
      description: "The version this backend was built as, and the oldest mobile app\
        \ release it still serves, needing no authentication to ask."
      tags:
      - Deployment
      responses:
        "200":
          description: The running version.
          content:
            application/json:
              examples:
                release:
                  value:
                    version: 1.3.0
                    minimumAppVersion: 1.0.0
              schema:
                $ref: "#/components/schemas/VersionResponse"
info:
  title: TaskFest API
  version: 1.1.1
  description: The task board's REST surface. Every response schema here is published
    as JSON Schema and checked at runtime by the frontend.
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: /
