# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
apiVersion: camel.apache.org/v1
kind: Kamelet
metadata:
  name: bitcoin-source
  annotations:
    camel.apache.org/kamelet.support.level: "Stable"
    camel.apache.org/catalog.version: "4.10.2"
    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PCEtLSBDcmVhdGVkIHdpdGggSW5rc2NhcGUgKGh0dHA6Ly93d3cuaW5rc2NhcGUub3JnLykgLS0+CjxzdmcgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNjQiIHdpZHRoPSI2NCIgdmVyc2lvbj0iMS4xIiB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgo8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwNjMwODc2LC0wLjAwMzAxOTg0KSI+CjxwYXRoIGZpbGw9IiNmNzkzMWEiIGQ9Im02My4wMzMsMzkuNzQ0Yy00LjI3NCwxNy4xNDMtMjEuNjM3LDI3LjU3Ni0zOC43ODIsMjMuMzAxLTE3LjEzOC00LjI3NC0yNy41NzEtMjEuNjM4LTIzLjI5NS0zOC43OCw0LjI3Mi0xNy4xNDUs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TI5LDQuMDIyLTIuMDM4LDQuNDgzLTUuMTU1em0tOC4wMjIsMTEuMjQ5Yy0xLjA4NSw0LjM2LTguNDI2LDIuMDAzLTEwLjgwNiwxLjQxMmwxLjkyOC03LjcyOWMyLjM4LDAuNTk0LDEwLjAxMiwxLjc3LDguODc4LDYuMzE3em0xLjA4Ni0xMS4zMTJjLTAuOTksMy45NjYtNy4xLDEuOTUxLTkuMDgyLDEuNDU3bDEuNzQ4LTcuMDFjMS45ODIsMC40OTQsOC4zNjUsMS40MTYsNy4zMzQsNS41NTN6Ii8+CjwvZz4KPC9zdmc+Cg=="
    camel.apache.org/provider: "Apache Software Foundation"
    camel.apache.org/kamelet.group: "Bitcoin"
    camel.apache.org/kamelet.namespace: "Bitcoin"
  labels:
    camel.apache.org/kamelet.type: "source"
spec:
  definition:
    title: "Bitcoin Source"
    description: |-
      Provides a feed of the value of the Bitcoin compared to USDT using the Binance service.
    type: object
    properties:
      period:
        title: Period between Updates
        description: The interval between updates in milliseconds
        type: integer
        default: 10000
  types:
    out:
      mediaType: application/json  
      schema:
        type: object
        properties:
          currencyPair:
            type: string
          open:
            type: number
          last:
            type: number
          bid:
            type: number
          ask:
            type: number
          high:
            type: number
          low:
            type: number
          vwap:
            type: number
          volume:
            type: number
          quoteVolume:
            type: number
          bidSize:
            type: number
          askSize:
            type: number
  dependencies:
    - "camel:xchange"
    - "camel:kamelet"
    - "camel:jackson"
    - "camel:timer"
  template:
    from:
      uri: "timer:update"
      parameters:
        period: "{{period}}"
      steps:
      - to: "xchange:binance?service=marketdata&method=ticker&currencyPair=BTC/USDT"
      - marshal:
          json: {}
      - to: "kamelet:sink"