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

extend type Query {
  assets(
    folderId: Int!
    kind: AssetKind!
  ): [AssetItem]

  assetsFolders(
    parentFolderId: Int!
  ): [AssetFolder]
}

extend type Mutation {
  createAssetsFolder(
    parentFolderId: Int!
    slug: String!
    name: String
  ): DefaultResponse

  renameAsset(
    id: Int!
    filename: String!
  ): DefaultResponse

  deleteAsset(
    id: Int!
  ): DefaultResponse

  flushTempUploads: DefaultResponse
}

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

type AssetItem {
  id: Int!
  filename: String!
  ext: String!
  kind: AssetKind!
  mime: String!
  fileSize: Int!
  metadata: String
  createdAt: Date!
  updatedAt: Date!
  folder: AssetFolder
  author: User
}

type AssetFolder {
  id: Int!
  slug: String!
  name: String
}

enum AssetKind {
  IMAGE
  BINARY
  ALL
}
