apiVersion: v1
kind: ConfigMap
metadata:
  name: integration-customer-offer-http
data:
  directs.yaml: |-
    # camel-k: language=yaml
    # camel-k: dependency=camel-quarkus-protobuf
    # camel-k: dependency=mvn:com.redhat.mercury:customer-offer-common:1.0.2-SNAPSHOT

    - from:
        uri: direct:Initiate
        steps:
          - set-body:
              simple: "{\"initiateCustomerOfferProcedureRequest\": ${body}}"
          - unmarshal:
              protobuf:
                instance-class: com.redhat.mercury.customeroffer.v10.api.crcustomerofferprocedureservice.CrCustomerOfferProcedureService$InitiateRequest
                content-type-format: json
          - to:
              uri: grpc://{{mercury.binding.service.host}}:{{mercury.binding.service.port}}/com.redhat.mercury.customeroffer.v10.api.crcustomerofferprocedureservice.CRCustomerOfferProcedureService?synchronous=true&method=Initiate
          - marshal:
              protobuf:
                instance-class: com.redhat.mercury.customeroffer.v10.InitiateCustomerOfferProcedureResponseOuterClass$InitiateCustomerOfferProcedureResponse
                content-type-format: json

    - from:
        uri: direct:Update
        steps:
          - set-body:
              simple: "{\"customerofferId\": \"${header.customerofferId}\", \"customerOfferProcedure\": ${body}}"
          - unmarshal:
              protobuf:
                instance-class: com.redhat.mercury.customeroffer.v10.api.crcustomerofferprocedureservice.CrCustomerOfferProcedureService$UpdateRequest
                content-type-format: json
          - to:
              uri: grpc://{{mercury.binding.service.host}}:{{mercury.binding.service.port}}/com.redhat.mercury.customeroffer.v10.api.crcustomerofferprocedureservice.CRCustomerOfferProcedureService?synchronous=true&method=Update
          - marshal:
              protobuf:
                instance-class: com.redhat.mercury.customeroffer.v10.CustomerOfferProcedureOuterClass$CustomerOfferProcedure
                content-type-format: json
