export type Notification = {
  id: string
  message: string
}

export type Asset = {
  key: string
  url: string
  group: 'tiles' | 'objects' | 'sprites' | 'sprite_animations' | 'sound' | 'music' | 'ui' | 'font' | 'other'
  frameWidth?: number
  frameHeight?: number
}

export type Tile = {
  id: string
  name: string
  tags: any | null
  createdAt: Date
  updatedAt: Date
}

export type Object = {
  id: string
  name: string
  tags: any | null
  origin_x: number
  origin_y: number
  isAnimated: boolean
  frameSpeed: number
  frameWidth: number
  frameHeight: number
  createdAt: Date
  updatedAt: Date
  ZoneObject: ZoneObject[]
}

export type Item = {
  id: string
  name: string
  description: string | null
  stackable: boolean
  createdAt: Date
  updatedAt: Date
  characters: CharacterItem[]
}

export type Zone = {
  id: number
  name: string
  width: number
  height: number
  tiles: any | null
  pvp: boolean
  zoneEventTiles: ZoneEventTile[]
  zoneObjects: ZoneObject[]
  characters: Character[]
  chats: Chat[]
  createdAt: Date
  updatedAt: Date
}

export type ZoneObject = {
  id: string
  zoneId: number
  zone: Zone
  objectId: string
  object: Object
  depth: number
  position_x: number
  position_y: number
}

export enum ZoneEventTileType {
  BLOCK = 'BLOCK',
  WARP = 'WARP',
  NPC = 'NPC',
  ITEM = 'ITEM'
}

export type ZoneEventTile = {
  id: string
  zoneId: number
  zone: Zone
  type: ZoneEventTileType
  position_x: number
  position_y: number
}

export type User = {
  id: number
  username: string
  password: string
  characters: Character[]
}

export enum CharacterGender {
  MALE = 'MALE',
  FEMALE = 'FEMALE'
}

export enum CharacterRace {
  HUMAN = 'HUMAN',
  ELF = 'ELF',
  DWARF = 'DWARF',
  ORC = 'ORC',
  GOBLIN = 'GOBLIN'
}

export type CharacterType = {
  id: number
  name: string
  gender: CharacterGender
  race: CharacterRace
  characters: Character[]
  spriteId: string
  sprite: Sprite
  createdAt: Date
  updatedAt: Date
}

export type Character = {
  id: number
  userId: number
  user: User
  name: string
  hitpoints: number
  mana: number
  level: number
  experience: number
  role: string
  position_x: number
  position_y: number
  rotation: number
  zoneId: number
  zone: Zone
  characterTypeId: number | null
  characterType: CharacterType | null
  chats: Chat[]
  items: CharacterItem[]
}

export type ExtendedCharacter = Character & {
  isMoving?: boolean
}

export type CharacterItem = {
  id: number
  characterId: number
  character: Character
  itemId: string
  item: Item
  quantity: number
}

export type Sprite = {
  id: string
  name: string
  createdAt: Date
  updatedAt: Date
  spriteActions: SpriteAction[]
  characterTypes: CharacterType[]
}

export type SpriteAction = {
  id: string
  spriteId: string
  sprite: Sprite
  action: string
  sprites: string[]
  origin_x: number
  origin_y: number
  isAnimated: boolean
  isLooping: boolean
  frameWidth: number
  frameHeight: number
  frameSpeed: number
}

export type Chat = {
  id: number
  characterId: number
  character: Character
  zoneId: number
  zone: Zone
  message: string
  createdAt: Date
}
