# ===============================================
# STORAGE
# ===============================================

extend type Query {
  storageTargets(
    siteId: UUID!
    ): [StorageTarget]
}

extend type Mutation {
  updateStorageTargets(
    siteId: UUID!
    targets: [StorageTargetInput]!
  ): DefaultResponse

  setupStorageTarget(
    targetId: UUID!
    state: JSON!
  ): StorageTargetSetupResponse

  destroyStorageTargetSetup(
    targetId: UUID!
  ): DefaultResponse

  executeStorageAction(
    targetId: UUID!
    handler: String!
  ): DefaultResponse
}

# -----------------------------------------------
# TYPES
# -----------------------------------------------

type StorageTarget {
  id: UUID
  isEnabled: Boolean
  module: String
  title: String
  description: String
  icon: String
  banner: String
  vendor: String
  website: String
  contentTypes: JSON
  assetDelivery: JSON
  versioning: JSON
  sync: JSON
  status: JSON
  setup: JSON
  config: JSON
  actions: JSON
}

type StorageTargetSetupResponse {
  operation: Operation
  state: JSON
}

input StorageTargetInput {
  id: UUID!
  module: String!
  isEnabled: Boolean
  contentTypes: [String!]
  largeThreshold: String
  assetDeliveryFileStreaming: Boolean
  assetDeliveryDirectAccess: Boolean
  syncMode: StorageTargetSyncMode
  syncInterval: String
  useVersioning: Boolean
  config: JSON
}

enum StorageTargetSyncMode {
  PULL
  PUSH
  SYNC
}
