module Dodge.Item 
    ( module Dodge.Item.Weapon
    , module Dodge.Item.Consumable
    , module Dodge.Item.Equipment
    , module Dodge.Item.PassKey
    , module Dodge.Item.Craftable
    , itemFromBase
    , baseToFamily
    ) where
import Dodge.Data
import Dodge.Item.Weapon
import Dodge.Item.Equipment
import Dodge.Item.Consumable
import Dodge.Item.PassKey
import Dodge.Item.Family
import Dodge.Item.Craftable

-- this is not ideal, should fold the itemtype into a stackable/unstackable type
itemFromBase :: ItemBaseType -> Item
itemFromBase ibt = case ibt of
    NOTDEFINED -> error "cannot create undefined item"
    EFFGUN _ -> undefined
    AUTOEFFGUN _ -> undefined
    -- Weapons
    BANGSTICK i -> bangStick i
    PISTOL      -> pistol
    REVOLVER    -> revolver
    REVOLVERX i   -> revolverX i
    MACHINEPISTOL   -> machinePistol
    AUTOPISTOL  -> autoPistol
    SMG     -> smg
    BANGCONE    -> bangCone
    BLUNDERBUSS     -> blunderbuss
    BIGBLUNDERBUSS  -> bigBlunderbuss
    BIGGERBLUNDERBUSS   -> biggerBlunderbuss
    BIGGESTBLUNDERBUSS  -> biggestBlunderbuss
--    GRAPESHOTCANNON     -> grapeShotCannon
    --GRENADELAUNCHER Int -- number of chambers that can be reloaded
--  --| MORTARCONE / HANDMORTAR
    BANGCANE    -> bangCane
    MINIGUNX i    -> miniGunX i
    BANGCANEX i   -> bangCaneX i 
    RIFLE   -> rifle
    REPEATER    -> repeater
    AUTORIFLE   -> autoRifle
    BURSTRIFLE  -> burstRifle
    FASTBURSTRIFLE  -> fastBurstRifle
    COMPLETEBURSTRIFLE  -> completeBurstRifle
    BANGROD     -> bangRod
    ELEPHANTGUN     -> elephantGun
    AMR     -> amr
    AUTOAMR     -> autoAmr
    SNIPERRIFLE     -> sniperRifle
    MACHINEGUN  -> machineGun
    FLAMESPITTER    -> flameSpitter
    FLAMETHROWER    -> flameThrower
    FLAMETORRENT    -> flameTorrent
    FLAMEWALL   -> flameWall
    BLOWTORCH   -> blowTorch
    AUTOGUN     -> autoGun
--    SPREADGUN   -> spreadGun
--    MULTGUN     -> multGun
    SPARKGUN    -> sparkGun
    TESLAGUN    -> teslaGun
    LASGUN  -> lasGun
    LASPULSE    -> lasPulse
    LASGUNDUAL  -> lasDual
    LASGUNSWING     -> lasSwing
    LASGUNSWAY  -> lasSway
    LASGUNWIDEPULSE     -> lasWidePulse
    LASGUNWIDE i  -> lasWide i
    LASGUNFOCUS i     -> lasFocus i
    SONICGUN    -> sonicGun
    TRACTORGUN  -> tractorGun
    LAUNCHER    -> launcher
    LAUNCHERX i   -> launcherX  i
--  --| TRACKINGLAUNCHER
    REMOTELAUNCHER -> remoteLauncher
    POISONSPRAYER   -> poisonSprayer
    DRONELAUNCHER   -> droneLauncher
    --GRENADE
    --REMOTEBOMB
    -- Utility items
    BOOSTER -> boosterGun
    REWINDER    -> rewindGun
    BLINKER     -> blinkGun
    BLINKERUNSAFE       -> unsafeBlinkGun
    FORCEFIELDGUN       -> forceFieldGun
    SHRINKER        -> shrinkGun
    SHATTERGUN        -> shatterGun
    SPAWNER     -> error "need to datify creatures first"
    -- Equipment
    CLICKDETECTOR d -> clickDetector d
    AUTODETECTOR  d -> autoDetector d
    MAGSHIELD -> magShield
    FLAMESHIELD     -> flameShield
    FRONTARMOUR     -> frontArmour
    WRISTARMOUR     -> wristArmour
    INVISIBILITYEQUIPMENT GoesOnWrist -> wristInvisibility
    INVISIBILITYEQUIPMENT _ -> error "need to define invisibility for more than wrist"
    BRAINHAT        -> brainHat
    HEADLAMP        -> headLamp
    HEADLAMP1       -> headLamp1
    POWERLEGS       -> powerLegs
    SPEEDLEGS       -> speedLegs
    JUMPLEGS        -> jumpLegs
    FLATSHIELD      -> flatShield
    JETPACK     -> jetPack
    CRAFT cr -> makeTypeCraft cr
    KEYCARD i -> keyCard i
    MEDKIT i -> medkit i
    --
    -- Crafting
    --PIPE
    --TUBE
    --HARDWARE
    --SPRING
    --CAN
    --TIN
    --DRUM
    --PLANK
    --SHARDGLASS
    --PUMP
    --MOTOR
    --TRANSFORMER
    --PRISM
    --LIGHTER
    --MAGNET
    --ANTIMATTER
    --PLATE
    --TRANSMITTER
    --MICROCHIP
    --AIUNIT
    --CAMERA
    --MINIDISPLAY  -- visual display unit
    --LED
    --NAILBOX
    --IRONBAR
    --LIGHTSENSOR
    --SOUNDSENSOR
    --HEATSENSOR
    --CREATURESENSOR
    --WIRE
    --BATTERY
    --FUELCELL
    --PORTABLEFUSION
    -- Modules
    -- bullet
    --INCENDIARYMODULE
    --STATICMODULE
    --CONCUSSMODULE
    --FRAGMODULE
    --FLASHMODULE
    --BOUNCEMODULE
    --
    --TELEPORTMODULE
    --TIMEMODULE
    --SIZEMODULE
    --GRAVITYMODULE
    --
    --
    --NoCombineType
    --
baseToFamily :: ItemBaseType -> ItemFamily
baseToFamily ibt = case ibt of
    NOTDEFINED -> undefined
    EFFGUN _ -> HeldFamily
    AUTOEFFGUN _ -> HeldFamily
    BANGSTICK _       -> HeldFamily
    PISTOL              -> HeldFamily
    REVOLVER            -> HeldFamily
    REVOLVERX _       -> HeldFamily
    MACHINEPISTOL       -> HeldFamily
    AUTOPISTOL          -> HeldFamily
    SMG                 -> HeldFamily
    BANGCONE            -> HeldFamily
    BLUNDERBUSS         -> HeldFamily
    BIGBLUNDERBUSS      -> HeldFamily
    BIGGERBLUNDERBUSS   -> HeldFamily
    BIGGESTBLUNDERBUSS  -> HeldFamily
--  | GRAPESHOTCANNON   -> HeldFamily
--  | GRENADELAUNCHER In-> HeldFamilyt -- number of chambers that can be reloaded
--  | MORTARCONE / HANDM-> HeldFamilyORTAR
    BANGCANE            -> HeldFamily
--  | MINIGUN           -> HeldFamily
    MINIGUNX _        -> HeldFamily
    BANGCANEX _       -> HeldFamily
    RIFLE               -> HeldFamily
    REPEATER            -> HeldFamily
    AUTORIFLE           -> HeldFamily
    BURSTRIFLE          -> HeldFamily
    FASTBURSTRIFLE      -> HeldFamily
    COMPLETEBURSTRIFLE  -> HeldFamily
    BANGROD             -> HeldFamily
    ELEPHANTGUN         -> HeldFamily
    AMR                 -> HeldFamily
    AUTOAMR             -> HeldFamily
    SNIPERRIFLE         -> HeldFamily
    MACHINEGUN          -> HeldFamily
    FLAMESPITTER        -> HeldFamily
    FLAMETHROWER        -> HeldFamily
    FLAMETORRENT        -> HeldFamily
    FLAMEWALL           -> HeldFamily
    BLOWTORCH           -> HeldFamily
    AUTOGUN             -> HeldFamily
--  | SPREADGUN         -> HeldFamily
--  | MULTGUN           -> HeldFamily
    SPARKGUN            -> HeldFamily
    TESLAGUN            -> HeldFamily
    LASGUN              -> HeldFamily
    LASPULSE            -> HeldFamily
    LASGUNDUAL          -> HeldFamily
    LASGUNSWING         -> HeldFamily
    LASGUNSWAY          -> HeldFamily
    LASGUNWIDEPULSE     -> HeldFamily
    LASGUNWIDE _      -> HeldFamily
    LASGUNFOCUS _     -> HeldFamily
    SONICGUN            -> HeldFamily
    TRACTORGUN          -> HeldFamily
    LAUNCHER            -> HeldFamily
    LAUNCHERX _         -> HeldFamily
--  | TRACKINGLAUNCHER  -> HeldFamily
    REMOTELAUNCHER      -> HeldFamily
    POISONSPRAYER       -> HeldFamily
    DRONELAUNCHER       -> HeldFamily
    SHATTERGUN          -> HeldFamily
--  | GRENADE
--  | REMOTEBOMB
    BOOSTER             -> LeftClickFamily
    REWINDER            -> LeftClickFamily
    BLINKER             -> LeftClickFamily
    BLINKERUNSAFE       -> LeftClickFamily
    FORCEFIELDGUN       -> LeftClickFamily
    SHRINKER            -> LeftClickFamily
    SPAWNER             -> LeftClickFamily
    CLICKDETECTOR _   -> HeldFamily
    AUTODETECTOR _    -> LeftClickFamily
    MAGSHIELD               -> EquipmentFamily
    FLAMESHIELD             -> EquipmentFamily
    FRONTARMOUR             -> EquipmentFamily
    WRISTARMOUR             -> EquipmentFamily
    INVISIBILITYEQUIPMENT _   -> EquipmentFamily
    BRAINHAT            -> EquipmentFamily
    HEADLAMP            -> EquipmentFamily
    HEADLAMP1           -> EquipmentFamily
    POWERLEGS           -> EquipmentFamily
    SPEEDLEGS           -> EquipmentFamily
    JUMPLEGS            -> EquipmentFamily
    FLATSHIELD          -> EquipmentFamily
    JETPACK             -> EquipmentFamily
    CRAFT _             -> CraftingFamily
    
    KEYCARD _   -> HeldFamily
    
    MEDKIT _    -> ConsumableFamily

