# ===============================================
# ASSETS
# ===============================================

extend type Query {
  assetById(
    id: UUID!
  ): AssetItem
}

extend type Mutation {
  renameAsset(
    id: UUID!
    fileName: String!
  ): DefaultResponse

  deleteAsset(
    id: UUID!
  ): DefaultResponse

  """
  Upload one or more assets.
  Must provide either `folderId` or a combination of `folderPath`, `locale` and `siteId`.
  """
  uploadAssets(
    folderId: UUID
    folderPath: String
    locale: String
    siteId: UUID
    files: [Upload!]!
  ): DefaultResponse

  flushTempUploads: DefaultResponse
}

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

type AssetItem {
  id: UUID
  fileName: String
  ext: String
  kind: AssetKind
  mime: String
  fileSize: Int
  metadata: JSON
  createdAt: Date
  updatedAt: Date
  author: User
}

enum AssetKind {
  document
  image
  other
}
