openapi: 3.1.0
info:
  title: Enterprise Detail Page Composition Contract
  version: 0.1.0
  description: >-
    Internal planning contract for the shared enterprise detail-page composition model.
    These schemas describe the logical read model that backs the HTML detail pages for the
    initial aligned targets.
paths:
  /admin/baseline-snapshots/{snapshot}:
    get:
      summary: Resolve BaselineSnapshot enterprise detail page data
      operationId: getBaselineSnapshotEnterpriseDetail
      parameters:
        - name: snapshot
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Shared enterprise detail page model for a BaselineSnapshot detail page
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnterpriseDetailPage'
                  - type: object
                    properties:
                      resourceType:
                        const: baseline_snapshot
  /admin/t/{tenant}/backup-sets/{backupSet}:
    get:
      summary: Resolve BackupSet enterprise detail page data
      operationId: getBackupSetEnterpriseDetail
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            type: string
        - name: backupSet
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Shared enterprise detail page model for a BackupSet detail page
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnterpriseDetailPage'
                  - type: object
                    properties:
                      resourceType:
                        const: backup_set
  /admin/t/{tenant}/entra-groups/{entraGroup}:
    get:
      summary: Resolve EntraGroup enterprise detail page data
      operationId: getEntraGroupEnterpriseDetail
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            type: string
        - name: entraGroup
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Shared enterprise detail page model for an EntraGroup detail page
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnterpriseDetailPage'
                  - type: object
                    properties:
                      resourceType:
                        const: entra_group
  /admin/operations/{run}:
    get:
      summary: Resolve OperationRun enterprise detail page data
      operationId: getOperationRunEnterpriseDetail
      parameters:
        - name: run
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Shared enterprise detail page model for an OperationRun detail page
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnterpriseDetailPage'
                  - type: object
                    properties:
                      resourceType:
                        const: operation_run
components:
  schemas:
    EnterpriseDetailPage:
      type: object
      required:
        - resourceType
        - scope
        - header
        - mainSections
        - supportingCards
        - technicalSections
      properties:
        resourceType:
          type: string
          enum:
            - baseline_snapshot
            - backup_set
            - entra_group
            - operation_run
        scope:
          type: string
          enum:
            - workspace
            - tenant
            - workspace-context
        header:
          $ref: '#/components/schemas/SummaryHeader'
        mainSections:
          type: array
          items:
            $ref: '#/components/schemas/DetailSection'
        supportingCards:
          type: array
          items:
            $ref: '#/components/schemas/SupportingCard'
        technicalSections:
          type: array
          items:
            $ref: '#/components/schemas/TechnicalSection'
        emptyStateNotes:
          type: array
          items:
            $ref: '#/components/schemas/EmptyState'
    SummaryHeader:
      type: object
      required:
        - title
        - statusBadges
        - keyFacts
        - primaryActions
      properties:
        title:
          type: string
        subtitle:
          type:
            - string
            - 'null'
        descriptionHint:
          type:
            - string
            - 'null'
        statusBadges:
          type: array
          items:
            $ref: '#/components/schemas/StatusBadge'
        keyFacts:
          type: array
          items:
            $ref: '#/components/schemas/KeyFact'
        primaryActions:
          type: array
          items:
            $ref: '#/components/schemas/PageAction'
    DetailSection:
      type: object
      required:
        - id
        - kind
        - title
        - visible
      properties:
        id:
          type: string
        kind:
          type: string
          enum:
            - core_details
            - current_status
            - related_context
            - operational_context
            - recent_activity
            - domain_detail
        title:
          type: string
        items:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/KeyFact'
              - $ref: '#/components/schemas/RelatedContextItem'
        action:
          oneOf:
            - $ref: '#/components/schemas/PageAction'
            - type: 'null'
        emptyState:
          oneOf:
            - $ref: '#/components/schemas/EmptyState'
            - type: 'null'
        visible:
          type: boolean
    SupportingCard:
      type: object
      required:
        - kind
        - title
        - visible
      properties:
        kind:
          type: string
          enum:
            - status
            - timestamps
            - related_context
            - quick_actions
            - health
            - summary
        title:
          type: string
        items:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/KeyFact'
              - $ref: '#/components/schemas/RelatedContextItem'
              - $ref: '#/components/schemas/PageAction'
        visible:
          type: boolean
    TechnicalSection:
      type: object
      required:
        - title
        - entries
        - visible
      properties:
        title:
          type: string
        entries:
          type: array
          items:
            $ref: '#/components/schemas/KeyFact'
        collapsible:
          type: boolean
        visible:
          type: boolean
    RelatedContextItem:
      type: object
      required:
        - label
        - contextType
        - available
      properties:
        label:
          type: string
        contextType:
          type: string
          enum:
            - parent
            - child
            - source_run
            - tenant
            - workspace
            - artifact
            - linked_record
        value:
          type:
            - string
            - 'null'
        url:
          type:
            - string
            - 'null'
        available:
          type: boolean
        emptyReason:
          type:
            - string
            - 'null'
    PageAction:
      type: object
      required:
        - label
        - placement
        - destructive
        - requiresConfirmation
        - visible
      properties:
        label:
          type: string
        placement:
          type: string
          enum:
            - header
            - supporting_card
            - section
        url:
          type:
            - string
            - 'null'
        actionName:
          type:
            - string
            - 'null'
        destructive:
          type: boolean
        requiresConfirmation:
          type: boolean
        visible:
          type: boolean
    StatusBadge:
      type: object
      required:
        - domain
        - value
      properties:
        domain:
          type: string
        value:
          type: string
        label:
          type:
            - string
            - 'null'
    KeyFact:
      type: object
      required:
        - label
      properties:
        label:
          type: string
        value:
          type:
            - string
            - integer
            - number
            - boolean
            - 'null'
        emphasis:
          type:
            - string
            - 'null'
    EmptyState:
      type: object
      required:
        - title
        - message
      properties:
        title:
          type: string
        message:
          type: string
        actionLabel:
          type:
            - string
            - 'null'
        actionUrl:
          type:
            - string
            - 'null'