- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief:  Export Cloud Healthcare API HL7v2 messages to Google Cloud Storage.
    description: Export Cloud Healthcare API HL7v2 messages to Google Cloud Storage.
    examples: |
      To export the hl7v2-store 'test-hl7v2-store' to the existing bucket 'testGcsBucket' in the folder 'someFolder', run:

        $ {command} test-hl7v2-store --gcs-uri=gs://testGcsBucket/someFolder --dataset=test-dataset

      To perform the same export, but exporting messages with the message view of 'RAW_ONLY', run:

        $ {command} test-hl7v2-store --gcs-uri=gs://testGcsBucket/someFolder --dataset=test-dataset --message-view=RAW_ONLY

  request:
    collection: healthcare.projects.locations.datasets.hl7V2Stores
    method: export
    ALPHA:
      api_version: v1alpha2
    BETA:
      api_version: v1beta1
    GA:
      api_version: v1

  arguments:
    resource:
      help_text: Cloud Healthcare API HL7v2 store to export messages from.
      spec: !REF googlecloudsdk.command_lib.healthcare.resources:hl7v2_store


    params:
    - arg_name: gcs-uri
      api_field: exportMessagesRequest.gcsDestination.uriPrefix
      required: true
      help_text: |
        The Cloud Storage destination location. Specify a path to a Cloud
        Storage bucket or folder rather than a concrete object. The exported
        messages are ordered by the message send_time (MSH.7) in ascending
        order. The server will create one or more objects. Each object contains
        newline delimited JSON, and each line is an HL7v2 message.
    - arg_name: start-time
      api_field: exportMessagesRequest.startTime
      help_text: |
        The start of the range in message send_time (MSH.7) to process. If not
        specified, the UNIX epoch (1970-01-01T00:00:00Z) is used.
    - arg_name: end-time
      api_field: exportMessagesRequest.endTime
      help_text: |
        The end of the range in message send_time (MSH.7) to process. If not
        specified, the time when the export is scheduled is used.
    - arg_name: message-view
      api_field: exportMessagesRequest.gcsDestination.messageView
      choices:
      - arg_value: raw-only
        enum_value: RAW_ONLY
        help_text: |
          Exported resources include all the message fields except parsedData
          and schematizedData fields.
      - arg_value: parsed-only
        enum_value: PARSED_ONLY
        help_text: |
            Exported resources include all the message fields except data and
            schematizedData fields.
      - arg_value: full
        enum_value: FULL
        help_text: |
            Exported resources include all the message fields.
      - arg_value: schematized-only
        enum_value: SCHEMATIZED_ONLY
        help_text: |
            Exported resources include all the message fields except data and
            parsedData fields.
      - arg_value: basic
        enum_value: BASIC
        help_text: |
            Exported resources include only the name field.
      help_text: |
        Specifies the parts of the Message resource to include in the export.
        The default is FULL.

  async:
    collection: healthcare.projects.locations.datasets.operations
