---
openapi: 3.1.0
components:
  schemas:
    Date:
      type: string
      format: date
      examples:
      - 2022-03-10
    Image:
      type: object
      properties:
        blobId:
          type: string
        blobPath:
          type: string
        id:
          type: string
        mimeType:
          type: string
        url:
          type: string
    ObjectId:
      type: string
      format: ObjectId
      description: MongoDB ObjectId represented as a string.
    SiteItem:
      type: object
      required:
      - name
      - siteId
      properties:
        id:
          $ref: "#/components/schemas/ObjectId"
          type: string
          description: Internal id
        name:
          type: string
        siteId:
          type: string
        slug:
          type: string
          readOnly: true
        featuredLayout:
          type: string
        hideChildrenOfTypes:
          type: array
          uniqueItems: true
          items:
            $ref: "#/components/schemas/SiteItemChildType"
        type:
          $ref: "#/components/schemas/SiteItemType"
    SiteItemChildType:
      type: string
      enum:
      - SITE_ITEM
      - COMPETITION
      - GROUP
    SiteItemType:
      type: string
      enum:
      - ROOT
      - AREA
      - EVENT
      - CONTENT
      - PRODUCT
    SortOrder:
      type: string
      enum:
      - Ascending
      - Descending
    TargetType:
      type: string
      enum:
      - AFFILIATE
      - BROADCAST
      - COMPETITION
      - GROUP
      - ORGANISATION
      - PARTNER
      - SITE
      - SITE_ITEM
      - SITE_SPONSOR
      - VENUE
    UIConfig:
      type: object
      required:
      - siteId
      - targetId
      properties:
        id:
          $ref: "#/components/schemas/ObjectId"
        bgColor:
          type: string
          pattern: "^#([A-Fa-f0-9]{6})$"
        bgImage:
          $ref: "#/components/schemas/Image"
        siteId:
          type: string
          pattern: \S
        targetId:
          type: string
          pattern: \S
        targetType:
          $ref: "#/components/schemas/TargetType"
  securitySchemes:
    SecurityScheme:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Authentication
paths:
  /site/structure:
    put:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteItem"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteItem"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
        "400":
          description: Bad Request
      summary: Update Item
      tags:
      - Site Structure Resource
      security:
      - SecurityScheme:
        - SuperAdmin
        - Admin
    get:
      parameters:
      - name: id
        in: query
        schema:
          type: array
          items:
            $ref: "#/components/schemas/ObjectId"
      - name: include-hidden
        in: query
        schema:
          type: boolean
      - name: name
        in: query
        schema:
          type: string
      - name: page-index
        in: query
        schema:
          type: integer
          format: int32
      - name: page-size
        in: query
        schema:
          type: integer
          format: int32
      - name: parentId
        in: query
        schema:
          $ref: "#/components/schemas/ObjectId"
      - name: site-id
        in: query
        schema:
          type: string
      - name: slug
        in: query
        schema:
          type: string
      - name: sort-column
        in: query
        schema:
          type: string
      - name: sort-order
        in: query
        schema:
          $ref: "#/components/schemas/SortOrder"
      - name: type
        in: query
        schema:
          $ref: "#/components/schemas/SiteItemType"
      - name: site-id
        in: header
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/SiteItem"
      summary: Get Content Items
      tags:
      - Site Structure Resource
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteItem"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteItem"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
        "400":
          description: Bad Request
      summary: Create Item
      tags:
      - Site Structure Resource
      security:
      - SecurityScheme:
        - SuperAdmin
        - Admin
  /site/structure/{itemId}:
    delete:
      parameters:
      - name: itemId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: boolean
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Delete Site Item
      tags:
      - Site Structure Resource
      security:
      - SecurityScheme:
        - SuperAdmin
        - Admin
  /site/structure/{siteItemId}:
    get:
      parameters:
      - name: siteItemId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SiteItem"
      summary: Get Site Item
      tags:
      - Site Structure Resource
  /site/ui-config:
    patch:
      requestBody:
        content:
          application/json:
            schema:
              type: string
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UIConfig"
      summary: Patch UI Config
      tags:
      - UI Config Resource
    get:
      parameters:
      - name: broadcast-id
        in: query
        schema:
          type: string
      - name: competition-id
        in: query
        schema:
          type: string
      - name: site-id
        in: query
        schema:
          type: string
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/UIConfig"
      summary: Get UI Configs
      tags:
      - UI Config Resource
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UIConfig"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UIConfig"
        "400":
          description: Bad Request
      summary: Create UI Config
      tags:
      - UI Config Resource
  /site/ui-config/{uiConfigId}:
    get:
      parameters:
      - name: uiConfigId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UIConfig"
      summary: Get UI Config
      tags:
      - UI Config Resource
    delete:
      parameters:
      - name: uiConfigId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: boolean
      summary: Delete UI Config
      tags:
      - UI Config Resource
info:
  title: Site Service API
  version: 1.2-SNAPSHOT
