# Name: Conversation Init
# JIT provisioning topic — loads user context (M365 profile) and glossary on the first user message.
# Combines both patterns into a single OnActivity topic. Remove sections you don't need.
# Replace all _REPLACE IDs with unique random IDs and <AGENT-SCHEMA-NAME> with the agent's schemaName prefix.
kind: AdaptiveDialog
modelDescription: null
beginDialog:
  kind: OnActivity
  id: main
  type: Message
  condition: =IsBlank(Global.UserCountry)
  actions:
    # --- User Context: M365 Profile ---
    - kind: InvokeConnectorAction
      id: getProfile_REPLACE1
      connectionReference: shared_office365users
      connectionProperties:
        mode: Invoker
      operationId: UserGet_V2
      output:
        kind: SingleVariableOutputBinding
        variable: init:Topic.M365Profile
    - kind: SetVariable
      id: setCountry_REPLACE2
      variable: Global.UserCountry
      value: =If(IsBlank(Topic.M365Profile.country), "Unknown", Topic.M365Profile.country)

    # --- Glossary: Load from Knowledge Source ---
    - kind: SearchAndSummarizeContent
      id: searchGlossary_REPLACE3
      autoSend: false
      variable: Topic.GlossaryResult
      userInput: ='*'
      responseCaptureType: FullResponse
      applyModelKnowledgeSetting: false
      knowledgeSources:
        kind: SearchSpecificKnowledgeSources
        knowledgeSources:
          - <AGENT-SCHEMA-NAME>.knowledge.glossary
    - kind: SetVariable
      id: setGlossary_REPLACE4
      variable: Global.Glossary
      value: =Topic.GlossaryResult
