kind: AdaptiveDialog
modelDescription: This tool allows a user to create a purchase order also known as a PO. After you create the PO through this topic always trigger the PO Approval topic to complete submitting this PO for approval and provide the PO number generated and PO value in this topic as the input for the PO number and PO value needed in the PO Approval topic.  Never ask the user to confirm if they want to get an approval, just automatically call that topic.
inputs:
  - kind: AutomaticTaskInput
    propertyName: SupplierName
    name: Supplier Name
    description: This collects the supplier's name that you are looking to make a purchase from.
    entity: StringPrebuiltEntity
    shouldPromptUser: true

  - kind: AutomaticTaskInput
    propertyName: PaymentTerms
    name: Payment Terms
    description: This will collect the terms for payment that is expected for this order such as 30, 60, 90, or 120 days.
    entity: StringPrebuiltEntity
    shouldPromptUser: true

  - kind: AutomaticTaskInput
    propertyName: ShippingMethod
    name: Shipping Method
    description: This collects the shipping method that you would like to collect such as FedEx, UPS, USPS, or DHL for the items of the PO.
    entity: StringPrebuiltEntity
    shouldPromptUser: true

  - kind: AutomaticTaskInput
    propertyName: POValue
    description: This is the value of the PO in USD also known as United States Dollars.
    entity: MoneyPrebuiltEntity
    shouldPromptUser: true
    inputSettings:
      validation: =Topic.POValue > 0
      invalidPrompt:
        activity: It doesn't look like your PO value is greater than $100.00.  We don't generate POs for suppliers under $100.00, please just purchase and expense the items.
        mode: Strict

      unrecognizedPrompt:
        activity: Sorry, I didn't see a monetary value try providing your response in USD such as $1,000 USD.
        mode: Strict

beginDialog:
  kind: OnRecognizedIntent
  id: main
  intent: {}
  actions:
    - kind: InvokeFlowAction
      id: invokeFlowAction_27xpMH
      input:
        binding:
          number: =Topic.POValue
          text: =Topic.SupplierName
          text_1: =Topic.PaymentTerms
          text_2: =Topic.ShippingMethod

      output:
        binding:
          ponumber: Topic.PONumberGen

      flowId: fff40ec2-e68b-ef11-ac20-7c1e52017a38

inputType:
  properties:
    PaymentTerms:
      displayName: Payment Terms
      description: This will collect the terms for payment that is expected for this order such as 30, 60, 90, or 120 days.
      type: String

    POValue:
      displayName: POValue
      type: Number

    ShippingMethod:
      displayName: Shipping Method
      description: This collects the shipping method that you would like to collect such as FedEx, UPS, USPS, or DHL for the items of the PO.
      type: String

    SupplierName:
      displayName: Supplier Name
      description: This collects the supplier's name that you are looking to make a purchase from.
      type: String

outputType:
  properties:
    PONumberGen:
      displayName: PONumberGen
      description: This is the PO Number that was generated trough this process.
      type: String