- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief:  Check the consents for a particular user's data.
    description: Check if each matching user data mapping in the given Cloud Healthcare API consent store is consented for a given use.
    examples: |
      To check if the data for user 'test-user-id' in the consent-store 'test-consent-store' can be used
      given request attributes {"organization":"admins", "use_case":"research"}, run:

        $ {command} test-consent-store --user-id=test-user-id --request-attributes=organization=admins,use_case=research --dataset=test-dataset

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

  arguments:
    resource:
      help_text: Cloud Healthcare API consent store where the requested data is stored.
      spec: !REF googlecloudsdk.command_lib.healthcare.resources:consent_store

    params:
    - arg_name: user-id
      api_field: evaluateUserConsentsRequest.userId
      required: true
      help_text: |
        The unique identifier of the user to evaluate consents for.
    - arg_name: resource-attributes
      metavar: KEY=VALUE
      api_field: evaluateUserConsentsRequest.resourceAttributes
      type: 'googlecloudsdk.calliope.arg_parsers:ArgDict:'
      help_text: |
        Comma-separated list of resource attributes associated with this access request. Each
        attribute has the form "KEY=VALUE". If no values are specified, then all data types are
        queried.
    - arg_name: request-attributes
      metavar: KEY=VALUE
      api_field: evaluateUserConsentsRequest.requestAttributes
      type: 'googlecloudsdk.calliope.arg_parsers:ArgDict:'
      help_text: |
        Comma-separated list of request attributes associated with this access request. Each
        attribute has the form "KEY=VALUE".
    - arg_name: consent-list
      type: 'googlecloudsdk.calliope.arg_parsers:ArgList:'
      api_field: evaluateUserConsentsRequest.consentList.consents
      help_text: |
        List of user consents to evaluate the access request against. They must have the same
        user_id as the data to check access for, exist in the current consent_store, and have a
        state of either ACTIVE or DRAFT. A maximum of 100 consents can be provided here.
    - arg_name: response-view
      api_field: evaluateUserConsentsRequest.responseView
      help_text: |
        The requested view of information provided in the response (BASIC or FULL).
    - arg_name: page-size
      api_field: evaluateUserConsentsRequest.pageSize
      help_text: |
        Limit on the number of user data mappings to return in a single response. If zero the
        default page size of 100 is used.
    - arg_name: page-token
      api_field: evaluateUserConsentsRequest.pageToken
      help_text: |
        Token to retrieve the next page of results.
