import {
  IItem,
  IItemContainer,
  ItemRarities,
  ItemSlotType,
  ItemSubType,
  ItemType,
  UserAccountTypes,
} from '@rpg-engine/shared';

const createBagItem = (id: string, tintColor: string): IItem => ({
  _id: id,
  hasUseWith: false,
  type: ItemType.Container,
  subType: ItemSubType.Other,
  textureAtlas: 'items',
  allowedEquipSlotType: [ItemSlotType.Inventory],
  isEquipable: false,
  isStackable: true,
  maxStackSize: 100,
  isUsable: false,
  isStorable: true,
  isTwoHanded: false,
  layer: 1,
  isItemContainer: true,
  isSolid: false,
  key: 'bag',
  texturePath: 'containers/bag.png',
  textureKey: 'bag',
  name: 'Bag',
  generateContainerSlots: 10,
  description:
    'You see a bag. It has made using leather and it has 10 total slots.',
  attack: 7,
  defense: 3,
  weight: 13,
  tiledId: 67,
  x: 320,
  y: 144,
  scene: 'MainScene',
  fullDescription:
    'You see a bag. It has made using leather and it has 10 total slots.',
  createdAt: '2022-06-04T03:18:09.335Z',
  updatedAt: '2022-06-04T18:16:49.056Z',
  rarity: ItemRarities.Common,
  tintColor,
});

export const items: IItem[] = [
  {
    _id: '629acef1c7c8e8002ff60736',
    hasUseWith: false,
    type: ItemType.Weapon,
    subType: ItemSubType.Sword,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.LeftHand, ItemSlotType.RightHand],
    maxStackSize: 1,
    isUsable: false,
    isStorable: true,
    layer: 1,
    isItemContainer: false,
    isSolid: false,
    isTwoHanded: false,
    key: 'short-sword-66',
    texturePath: 'swords/short-sword.png',
    textureKey: 'short-sword',
    name: "Carpenter's Axe",
    description:
      'You see a short sword. It is a single-handed sword with a handle that just features a grip.',
    attack: 5,
    defense: 0,
    weight: 10,
    tiledId: 66,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription:
      'You see a short sword. It is a single-handed sword with a handle that just features a grip.',
    isEquipable: true,
    isStackable: false,
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Legendary,
    canBePurchasedOnlyByPremiumPlans: [
      UserAccountTypes.PremiumGold,
      UserAccountTypes.PremiumUltimate,
    ],
    minRequirements: {
      level: 10,
      skill: {
        name: 'sword',
        level: 5,
      },
    },
    attachedGems: [
      {
        gemEntityEffectsAdd: ['poison'],
        key: 'ruby-gem',
        name: 'Ruby Gem',
        gemStatBuff: {
          attack: 5,
          defense: 4,
        },
      },
      {
        gemEntityEffectsAdd: ['poison'],
        key: 'misty-quartz-gem',
        name: 'Misty Quartz Gem',
        gemStatBuff: {
          attack: 5,
          defense: 4,
        },
      },
      {
        gemEntityEffectsAdd: ['poison'],
        key: 'coral-reef-gem',
        name: 'Coral Reef Gem',
        gemStatBuff: {
          attack: 5,
          defense: 4,
        },
      },
      {
        gemEntityEffectsAdd: ['poison'],
        key: 'emerald-gem',
        name: 'Emerald Gem',
        gemStatBuff: {
          attack: 5,
          defense: 4,
        },
      },
    ],
    equippedBuffDescription: 'Character speed +10%',
    entityEffectChance: 50,
    entityEffects: ['freezing'],
  },
  {
    _id: '629acef1c7c8e8002ff73564',
    hasUseWith: false,
    type: ItemType.Weapon,
    subType: ItemSubType.Axe,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.LeftHand, ItemSlotType.RightHand],
    maxStackSize: 1,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: false,
    maxRange: 10,
    isSolid: false,
    key: 'board-sword-20',
    texturePath: 'ranged-weapons/bow.png',
    textureKey: 'bow',
    name: 'Bow',
    description: 'You see a broad bow.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a board bow.',
    isEquipable: true,
    isStackable: false,
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Epic,
    attachedGems: [
      {
        gemEntityEffectsAdd: ['poison'],
        key: 'emerald-gem',
        name: 'Emerald Gem',
        gemStatBuff: {
          attack: 5,
          defense: 4,
        },
      },
      {
        gemEntityEffectsAdd: ['poison'],
        key: 'emerald-gem',
        name: 'Emerald Gem',
        gemStatBuff: {
          attack: 5,
          defense: 4,
        },
      },
    ],
  },
  {
    _id: '629acef1c7c8e8002ff60723',
    hasUseWith: false,
    type: ItemType.Consumable,
    subType: ItemSubType.Potion,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Inventory],
    isEquipable: false,
    isStackable: true,
    maxStackSize: 99,
    isTwoHanded: false,
    stackQty: 3,
    isUsable: true,
    isStorable: true,
    layer: 1,
    isItemContainer: false,
    isSolid: false,
    key: 'board-sword-22',
    texturePath: 'potions/greater-life-potion.png',
    textureKey: 'greater-life-potion',
    name: 'Greater Life Potion',
    description: 'Recover your life',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'Recover your life',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Uncommon,
  },
  {
    _id: '629acek4j7c8e8002ff60034',
    hasUseWith: false,
    type: ItemType.Consumable,
    subType: ItemSubType.Food,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Inventory],
    isEquipable: false,
    isStackable: true,
    maxStackSize: 99,
    stackQty: 100,
    isUsable: true,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: false,
    isSolid: false,
    key: 'board-sword-21',
    texturePath: 'potions/mana-potion.png',
    textureKey: 'mana-potion',
    name: 'Mana Potion',
    description: 'Recover your mana',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'Recover your mana',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Rare,
  },
  {
    _id: '629acek4j7c8e8002fg60034',
    hasUseWith: true,
    type: ItemType.Consumable,
    subType: ItemSubType.Armor,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Torso],
    isEquipable: false,
    isStackable: true,
    maxStackSize: 100,
    isTwoHanded: false,

    isUsable: true,
    isStorable: true,
    layer: 1,
    isItemContainer: false,
    isSolid: false,
    key: 'silver-key',
    texturePath: 'others/silver-key.png',
    textureKey: 'silver-key',
    name: 'Key',
    description: 'Open the gates, but use the key!',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'Key to open things',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7c8e8002ff60403',
    type: ItemType.CraftingResource,
    hasUseWith: false,
    subType: ItemSubType.Other,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Inventory],
    isEquipable: false,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 32,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: false,
    isSolid: false,
    key: 'rune-22',
    texturePath: 'magics/rune.png',
    textureKey: 'rune',
    name: 'Some Shard',
    description: 'Use this to craft things!',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'Somes shard, some crafts.',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  createBagItem('392acek4j7c8e8002ff60404', '#FF0000'), // red
  createBagItem('392acek4j7c8e8002ff60405', '#0000FF'), // blue
  createBagItem('392acek4j7c8e8002ff60406', '#00FF00'), // green
  createBagItem('392acek4j7c8e8002ff60407', '#FFFF00'), // yellow
  createBagItem('392acek4j7c8e8002ff60408', '#800080'), // purple
  createBagItem('392acek4j7c8e8002ff60409', '#FFA500'), // orange
  createBagItem('392acek4j7c8e8002ff60410', '#00FFFF'), // cyan
  createBagItem('392acek4j7c8e8002ff60411', '#FFFFFF'), // white
  {
    _id: '392acek4j7c8e80d2fs60404',
    hasUseWith: false,
    type: ItemType.Accessory,
    subType: ItemSubType.Ranged,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Accessory],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 1,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'stone',
    texturePath: 'ranged-weapons/stone.png',
    textureKey: 'stone',
    name: 'stone',
    generateContainerSlots: 10,
    description: 'You see a stone. It is used with slingshot.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7c8e80d2fs60404',
    hasUseWith: false,
    type: ItemType.Accessory,
    subType: ItemSubType.Ranged,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Accessory],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 2,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'stone',
    texturePath: 'ranged-weapons/stone.png',
    textureKey: 'stone',
    name: 'stone',
    generateContainerSlots: 10,
    description: 'You see a stone. It is used with slingshot.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7c8e80d2fs60404',
    hasUseWith: false,
    type: ItemType.Accessory,
    subType: ItemSubType.Ranged,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Accessory],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 3,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'stone',
    texturePath: 'ranged-weapons/stone.png',
    textureKey: 'stone',
    name: 'stone',
    generateContainerSlots: 10,
    description: 'You see a stone. It is used with slingshot.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7c8e80d2fs60404',
    hasUseWith: false,
    type: ItemType.Accessory,
    subType: ItemSubType.Ranged,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Accessory],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 4,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'stone',
    texturePath: 'ranged-weapons/stone.png',
    textureKey: 'stone',
    name: 'stone',
    generateContainerSlots: 10,
    description: 'You see a stone. It is used with slingshot.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7c8e80d2fs60404',
    hasUseWith: false,
    type: ItemType.Accessory,
    subType: ItemSubType.Ranged,
    textureAtlas: 'items',
    allowedEquipSlotType: [ItemSlotType.Accessory],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 5,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'stone',
    texturePath: 'ranged-weapons/stone.png',
    textureKey: 'stone',
    name: 'stone',
    generateContainerSlots: 10,
    description: 'You see a stone. It is used with slingshot.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7c8e80d2fs60404',
    hasUseWith: false,
    type: ItemType.Other,
    subType: ItemSubType.Other,
    textureAtlas: 'items',
    allowedEquipSlotType: [],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 9999,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'gold-coin',
    texturePath: 'others/gold-coin.png',
    textureKey: 'gold-coin',
    name: 'gold-coin',
    generateContainerSlots: 10,
    description: 'You see a coin.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7c8e80d2fs60404',
    hasUseWith: false,
    type: ItemType.Other,
    subType: ItemSubType.Other,
    textureAtlas: 'items',
    allowedEquipSlotType: [],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 203.200000000000008,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'gold-coin',
    texturePath: 'others/gold-coin.png',
    textureKey: 'gold-coin',
    name: 'gold-coin',
    generateContainerSlots: 10,
    description: 'You see a coin.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    _id: '392acek4j7casd0d2fs60404',
    hasUseWith: false,
    type: ItemType.Other,
    subType: ItemSubType.Other,
    textureAtlas: 'items',
    allowedEquipSlotType: [],
    isEquipable: true,
    isStackable: true,
    maxStackSize: 100,
    stackQty: 345,
    isUsable: false,
    isStorable: true,
    isTwoHanded: false,
    layer: 1,
    isItemContainer: true,
    isSolid: false,
    key: 'gold-coin',
    texturePath: 'others/gold-coin.png',
    textureKey: 'gold-coin',
    name: 'gold-coin',
    generateContainerSlots: 10,
    description: 'You see a coin.',
    attack: 7,
    defense: 3,
    weight: 13,
    tiledId: 67,
    x: 320,
    y: 144,
    scene: 'MainScene',
    fullDescription: 'You see a stone. It is used with slingshot',
    createdAt: '2022-06-04T03:18:09.335Z',
    updatedAt: '2022-06-04T18:16:49.056Z',
    rarity: ItemRarities.Common,
  },
  {
    type: ItemType.Consumable,
    subType: ItemSubType.Food,
    rarity: 'Common',
    textureAtlas: 'items',
    allowedEquipSlotType: [],
    maxStackSize: 100,
    isUsable: false,
    isStorable: true,
    isItemContainer: false,
    isSolid: false,
    requiredAmmoKeys: [],
    isTwoHanded: false,
    hasUseWith: false,
    entityEffects: [],
    entityEffectChance: 0,
    _id: '64529049d45546003b2c6c6d',
    key: 'apple',
    texturePath: 'foods/apple.png',
    textureKey: 'apple',
    isEquipable: false,
    isStackable: true,
    name: 'Apple',
    description: 'A red apple.',
    weight: 0.05,
    stackQty: 16,
    attack: 0,
    defense: 0,
    fullDescription: '',
    usableEffectDescription: 'Regenerates 10 HP and Mana 5 times',
  },
];

export const itemContainerMock = (
  props?: Record<string, unknown>
): IItemContainer => {
  {
    return {
      _id: '629ba0b6fe3f43002f58f23b',
      name: 'Item Container',
      owner: '629ba0b6fe3f43002f58f23b',
      slotQty: 40,
      slots: {
        0: items[0],
        1: items[1],
        2: items[2],
        3: items[3],
        4: items[4],
        5: items[5],
        6: items[6],
        7: items[7],
        8: items[8],
        9: items[9],
        10: items[10],
        11: items[11],
        12: items[12],
        13: items[13],
        14: items[14],
        15: items[15],
        16: items[16],
        17: items[17],
        18: items[18],
        19: items[19],
        20: items[20],
        //remaining slots are considered null by default
      },
      allowedItemTypes: [],
      parentItem: '629ba0b6fe3f43002f58f239',
      isEmpty: false,
      createdAt: '2022-06-04T18:13:10.581Z',
      updatedAt: '2022-06-04T18:13:10.581Z',
      ...props,
    };
  }
};
