kind: AdaptiveDialog
modelDescription: This tool allows a user to approve a purchase order also known as a PO. If no PO number is provided then you can ask the user if they want to create a PO and if they say they do then trigger the PO creation process and then get approval for the generated PO from that process.
inputs:
  - kind: AutomaticTaskInput
    propertyName: POValue
    description: This is the value of the PO that is seeking an approval.
    entity: NumberPrebuiltEntity
    shouldPromptUser: true

  - kind: AutomaticTaskInput
    propertyName: PONumber
    description: This is the PO number that is seeking an approval.
    entity: StringPrebuiltEntity
    shouldPromptUser: true

beginDialog:
  kind: OnRecognizedIntent
  id: main
  intent: {}
  actions:
    - kind: InvokeFlowAction
      id: invokeFlowAction_rx25QQ
      input:
        binding:
          number: =Topic.POValue
          text: =Topic.PONumber

      output:
        binding:
          approvalnum: Topic.ApprovalNum
          approvalstatus: Topic.ApprovalStatus
          approved: Topic.AutoApproved

      flowId: 927f7a1c-ea8b-ef11-ac20-7c1e52017a38

inputType:
  properties:
    PONumber:
      displayName: PONumber
      description: This is the PO number that is seeking an approval.
      type: String

    POValue:
      displayName: POValue
      description: This is the value of the PO that is seeking an approval.
      type: Number

outputType:
  properties:
    ApprovalNum:
      displayName: ApprovalNum
      description: This is the tracking ID for your pending approval that has been submitted if you have not been auto approved.  This will have a value only if your request is pending approval.
      type: String

    ApprovalStatus:
      displayName: ApprovalStatus
      description: This provides the current status of the PO approval status.  This should be the authoritative answer for the status of the PO approval.
      type: String

    AutoApproved:
      displayName: AutoApproved
      description: This provides if your PO was auto approved by the system or had to be submitted to the approval system for further review.
      type: Boolean