# 1x3 grid
title_bucket_prefix: &title_bucket_prefix
  - type: text
    name: title
    label: Storage Name
    required: true
  - type: text
    name: bucket
    label: Bucket Name
    required: true
  - type: text
    name: prefix
    label: Bucket Prefix

gcs_credentials: &gcs_credentials
  - type: password
    name: google_application_credentials
    label: Google Application Credentials
    footer: Paste the contents of credentials.json in this field OR leave it blank to use ADC.
    autoComplete: "new-password"
    skipAutofill: true
    allowEmpty: false
    validators:
      - json

project_id: &project_id
  - type: text
    name: google_project_id
    label: Google Project ID
    footer: Leave blank to inherit from Google Application Credentials.

ImportStorage:
  # Title, Bucket, Prefix
  - columnCount: 3
    fields: *title_bucket_prefix
  # Regex filter
  - columnCount: 1
    fields:
      - type: text
        name: regex_filter
        label: File Filter Regex
        placeholder: '.*csv or .*(jpe?g|png|tiff) or .\w+-\d+.text'
        validators:
          - regexp

  # GCS credentials
  - columnCount: 1
    fields: *gcs_credentials
  # Project ID
  - columnCount: 1
    fields: *project_id

  # Import method selection
  - columnCount: 1
    fields:
      - type: select
        name: use_blob_urls
        label: Import method
        description: Choose how to import your data from storage
        placeholder: "Select an option"
        required: true
        options:
          - value: true
            label: "Files - Automatically creates a task for each storage object (e.g. JPG, MP3, TXT)"
          - value: false
            label: "Tasks - Treat each JSON or JSONL file as a task definition (one or more tasks per file)"

  # 2 columns grid
  - columnCount: 2
    columns:
      - width: 468
        fields:
        - type: toggle
          name: presign
          label: "Use pre-signed URLs (On)\n Proxy through the platform (Off)"
          description: "When pre-signed URLs are enabled, all data bypasses the platform and user browsers directly read data from storage"
          value: true
      - fields:
        - type: counter
          name: presign_ttl
          label: Expire pre-signed URLs (minutes)
          min: 1
          value: 15
          dependency: presign

ExportStorage:
  - columnCount: 3
    fields: *title_bucket_prefix
  - columnCount: 1
    fields: *gcs_credentials
  # Project ID
  - columnCount: 1
    fields: *project_id
