- release_tracks: [ALPHA, BETA, GA]

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

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

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

  arguments:
    resource:
      help_text: Cloud Healthcare API FHIR store to export resources from.
      spec: !REF googlecloudsdk.command_lib.healthcare.resources:fhir_store


    params:
    - arg_name: gcs-uri
      api_field: exportResourcesRequest.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 outputs
        are organized by FHIR resource types. The server will create one object per
        resource type. Each object contains newline delimited JSON, and each line
        is a FHIR resource.
    - arg_name: resource-type
      api_field: exportResourcesRequest._type
      help_text: |
        String of comma-delimited FHIR resource types. If provided, only resources of the specified
        resource type(s) are exported.
    - arg_name: since
      api_field: exportResourcesRequest._since
      help_text: |
        If provided, only resources updated after this time are exported. The time uses the format
        YYYY-MM-DDThh:mm:ss.sss+zz:zz. For example, 2015-02-07T13:28:17.239+02:00 or 2017-01-01T00:00:00Z.
        The time must be specified to the second and include a time zone.

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