type Approval @entity(immutable: true) {
  id: Bytes!
  owner: Bytes! # address
  approved: Bytes! # address
  tokenId: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type ApprovalForAll @entity(immutable: true) {
  id: Bytes!
  owner: Bytes! # address
  operator: Bytes! # address
  approved: Boolean! # bool
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type CollectionRoleGranted @entity(immutable: true) {
  id: Bytes!
  role: Int! # uint8
  toAddress: Bytes! # address
  byAddress: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type CollectionRoleRevoked @entity(immutable: true) {
  id: Bytes!
  role: Int! # uint8
  toAddress: Bytes! # address
  byAddress: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type NewBuild @entity(immutable: true) {
  id: Bytes!
  token: BigInt! # uint256
  commitHash: String! # string
  triggeredBy: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type NewTokenDescription @entity(immutable: true) {
  id: Bytes!
  token: BigInt! # uint256
  description: String! # string
  triggeredBy: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type NewTokenENS @entity(immutable: true) {
  id: Bytes!
  token: BigInt! # uint256
  ENS: String! # string
  triggeredBy: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type NewTokenExternalURL @entity(immutable: true) {
  id: Bytes!
  token: BigInt! # uint256
  externalURL: String! # string
  triggeredBy: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type NewTokenImage @entity(immutable: true) {
  id: Bytes!
  token: BigInt! # uint256
  image: String! # string
  triggeredBy: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type NewTokenName @entity(immutable: true) {
  id: Bytes!
  token: BigInt! # uint256
  name: String! # string
  triggeredBy: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type TokenRoleGranted @entity(immutable: true) {
  id: Bytes!
  tokenId: BigInt! # uint256
  role: Int! # uint8
  toAddress: Bytes! # address
  byAddress: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type TokenRoleRevoked @entity(immutable: true) {
  id: Bytes!
  tokenId: BigInt! # uint256
  role: Int! # uint8
  toAddress: Bytes! # address
  byAddress: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type Transfer @entity(immutable: true) {
  id: Bytes!
  from: Bytes! # address
  to: Bytes! # address
  tokenId: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type Token @entity {
  id: Bytes! # Token ID
  mint_transaction_hash: Bytes!
  tokenId: BigInt! # uint256
  owner: Owner!
  minted_by: Bytes!
  controllers: [Controller!]
}

type Owner @entity {
  id: Bytes! #address
  tokens: [Token!] @derivedFrom(field: "owner")
}

type Controller @entity {
  id: Bytes! #address
  tokens: [Token!] @derivedFrom(field: "controllers")
}
