---
openapi: 3.0.1
info:
  title: UI Customization API
  description: API for getting customization of UI
  version: v5

paths:
  /frontoffice/api/v5/ui/customization:
    get:
      tags:
        - UI Customization
      summary: Get current customization
      operationId: getUICustomizationV5
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGetUICustomization'

  /frontoffice/api/v5/ui/customization/files/{fileType}:
    get:
      tags:
        - UI Customization Files
      summary: Download a customization file
      operationId: getUICustomizationFileV5
      parameters:
        - name: fileType
          in: path
          required: true
          schema:
            type: string
            enum: ["FaviconIco", "FaviconSvg", "LogoDarkThemeShort", "LogoDarkTheme", "LogoLightThemeShort", "LogoLightTheme"]
        - name: v
          in: query
          required: false
          description: >
            Version token from the `files` map. When it matches the current version the response is
            cacheable (`Cache-Control: public, max-age=31536000, immutable`); otherwise the current
            file is returned with `Cache-Control: no-store`.
          schema:
            type: string
            example: "01KVA980BR0H92RXCHVHVRHJX5"
      responses:
        '200':
          description: OK
          headers:
            ETag:
              description: File version tag
              schema:
                type: string
                example: "\"01KVA980BR0H92RXCHVHVRHJX5\""
            Cache-Control:
              description: >
                `public, max-age=31536000, immutable` when `v` matches the current version; `no-store`
                otherwise.
              schema:
                type: string
                example: "public, max-age=31536000, immutable"
          content:
            image/png:
              schema:
                type: string
                format: binary
            image/jpeg:
              schema:
                type: string
                format: binary
            image/svg+xml:
              schema:
                type: string
                format: binary
            image/x-icon:
              schema:
                type: string
                format: binary
        '304':
          description: Not Modified
        '400':
          description: >
            `fileType` is not a defined member of the enum — an unknown name or a number outside it.
            Model binding rejects it as a validation error before the endpoint runs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
        '404':
          description: >
            `fileType` is `Unspecified` (by name or as `0`) — the one defined value this endpoint does
            not serve — or the stored reference points at no file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'

components:
  schemas:
    ApiGetUICustomization:
      type: object
      required:
        - projectName
        - defaultTheme
        - isLightEnabled
        - isDarkEnabled
        - light
        - dark
      properties:
        projectName:
          type: string
          description: Project name
          example: "MyProject"
        defaultTheme:
          type: string
          description: Default theme
          enum: ["LightTheme", "DarkTheme"]
          example: "LightTheme"
        isLightEnabled:
          type: boolean
        isDarkEnabled:
          type: boolean
        light:
          $ref: '#/components/schemas/ApiThemePalette'
        dark:
          $ref: '#/components/schemas/ApiThemePalette'
        files:
          $ref: '#/components/schemas/ApiFilePaths'

    ApiThemePalette:
      type: object
      required:
        - accent
        - accent-hover
        - background
        - card
        - demo
        - disabled
        - divider
        - field
        - medium
        - negative
        - overlay
        - positive
        - text-contrast
        - text-main
        - text-secondary
        - tooltip
      properties:
        accent:
          type: string
        accent-hover:
          type: string
        background:
          type: string
        card:
          type: string
        demo:
          type: string
        disabled:
          type: string
        divider:
          type: string
        field:
          type: string
        medium:
          type: string
        negative:
          type: string
        overlay:
          type: string
        positive:
          type: string
        text-contrast:
          type: string
        text-main:
          type: string
        text-secondary:
          type: string
        tooltip:
          type: string

    ApiFilePaths:
      type: object
      description: >
        Absolute URLs of the customization files, each carrying a version token that changes when the
        file is replaced. Use the value as-is; do not append query parameters. A value that is not an
        absolute URL is a default asset shipped with the client and must be resolved against the
        client's own origin.
      properties:
        FaviconIco:
          type: string
          example: "https://bbp-ts-api-staging1.flexprotect.org/frontoffice/api/v5/ui/customization/files/FaviconIco?v=01KVA98095QCY8QYKYRJY5FJJR"
        FaviconSvg:
          type: string
          example: "https://bbp-ts-api-staging1.flexprotect.org/frontoffice/api/v5/ui/customization/files/FaviconSvg?v=01KVA980BR0H92RXCHVHVRHJX5"
        LogoDarkThemeShort:
          type: string
          example: "https://bbp-ts-api-staging1.flexprotect.org/frontoffice/api/v5/ui/customization/files/LogoDarkThemeShort?v=01KVA980CX3J7QZNVGT2WMDKQF"
        LogoDarkTheme:
          type: string
          example: "https://bbp-ts-api-staging1.flexprotect.org/frontoffice/api/v5/ui/customization/files/LogoDarkTheme?v=01KVA980D8P4M6RSXBFC9NHKTV"
        LogoLightThemeShort:
          type: string
          example: "https://bbp-ts-api-staging1.flexprotect.org/frontoffice/api/v5/ui/customization/files/LogoLightThemeShort?v=01KVA980DZ1K5WYHQTGN8RJCVM"
        LogoLightTheme:
          type: string
          example: "https://bbp-ts-api-staging1.flexprotect.org/frontoffice/api/v5/ui/customization/files/LogoLightTheme?v=01KVA980EJ6R3TFXNCWZ9SBQKD"

    BBP.Platform.Http.ErrorData:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          $ref: '#/components/schemas/BBP.Platform.Http.ErrorData.ErrorDetails'
      additionalProperties: false
    BBP.Platform.Http.ErrorData.ErrorDetails:
      type: object
      properties:
        source:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        stackTrace:
          type: string
          nullable: true
      additionalProperties: false
