enum ToolType {
    LANGUAGE = 0b0001,
    FRAMEWORK = 0b0010,
    LIB_OR_PACKAGE = 0b0100,
    OTHER = 0b1000
}

enum ToolPlatform {
    MOBILE = 0b00001,
    WEB_FRONT = 0b00010,
    WEB_BACK = 0b00100,
    SYSTEM = 0b01000,
    DESKTOP = 0b10000
}

interface Tool {
    type: ToolType,
    name: string,
    version: string | null,
    description: string | null,
    icon: string | null,
    url: string,
    depend_tools: Tool[],
    developed_platforms: ToolPlatform[]
}

export default Tool

// RUBY

export const TOOLS: Tool[] = [
    Ruby, Rails, Php, Symfony, Sylius, Javascript, Typescript, React, Hotwire, Dart, Flutter, Rust,
    CSS, SASS, Tailwind, Bootstrap,
    Webpack, RequireJS, Vite,
    Java, OpenGL, LWJGL, CSharp, Unity3D, GodotEngine
]

/**
 * @param types
 * @example
 *      filterToolByTypes(ToolType.FRAMEWORK | ToolType.LANGUAGE)
 */
export function filterToolByTypes(types: number) {
    TOOLS.filter((t) => t.type.valueOf() & types > 0)
}

export const Ruby: Tool = {
    type: ToolType.LANGUAGE,
    name: 'Ruby',
    version: '2.7 - 3.2',
    icon: null,
    description: null,
    url: 'https://www.ruby-lang.org/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.MOBILE, ToolPlatform.WEB_BACK]
}

export const Rails: Tool = {
    type: ToolType.FRAMEWORK,
    name: 'Ruby on rails',
    version: '5.1 - 7.0',
    icon: null,
    description: null,
    url: 'https://rubyonrails.org/',
    depend_tools: [Ruby],
    developed_platforms: [ToolPlatform.WEB_BACK]
}

// PHP

export const Php: Tool = {
    type: ToolType.LANGUAGE,
    name: 'PHP',
    icon: null,
    version: '5 et 7',
    description: null,
    url: 'https://www.php.net/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.WEB_BACK]
}

export const Symfony: Tool = {
    type: ToolType.FRAMEWORK,
    name: 'Symfony',
    version: '4.0 - 5.0',
    icon: null,
    description: null,
    url: 'https://symfony.com/',
    depend_tools: [Php],
    developed_platforms: [ToolPlatform.WEB_BACK]
}

export const Sylius: Tool = {
    type: ToolType.FRAMEWORK,
    name: 'Sylius',
    version: '1.6',
    icon: null,
    description: null,
    url: 'https://symfony.com/',
    depend_tools: [Symfony],
    developed_platforms: [ToolPlatform.WEB_BACK]
}

// JS

export const Javascript: Tool = {
    type: ToolType.LANGUAGE,
    name: 'Javascript',
    version: null,
    icon: null,
    description: null,
    url: 'https://www.javascript.com/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.WEB_BACK, ToolPlatform.WEB_FRONT]
}

export const Typescript: Tool = {
    type: ToolType.LANGUAGE,
    name: 'Typescript',
    version: null,
    icon: null,
    description: null,
    url: 'https://www.typescriptlang.org/',
    depend_tools: [],
    developed_platforms: Javascript.developed_platforms
}

export const React: Tool = {
    type: ToolType.FRAMEWORK,
    name: 'React',
    version: '14, 15, 16, 17, 18',
    icon: null,
    description: null,
    url: 'https://react.dev/',
    depend_tools: [Javascript, Typescript],
    developed_platforms: [ToolPlatform.WEB_FRONT]
}

export const Hotwire: Tool = {
    type: ToolType.FRAMEWORK,
    name: 'Hotwire',
    version: '2 - 3',
    icon: null,
    description: 'Turbo + Stimulus',
    url: 'https://stimulus.hotwired.dev/',
    depend_tools: [Javascript, Typescript, Rails],
    developed_platforms: [ToolPlatform.WEB_FRONT]
}

// CSS

export const CSS: Tool = {
    type: ToolType.LANGUAGE,
    name: 'CSS',
    version: null,
    icon: null,
    description: null,
    url: 'https://www.w3schools.com/css/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.MOBILE, ToolPlatform.DESKTOP, ToolPlatform.WEB_FRONT]
}

export const SASS: Tool = {
    type: ToolType.LANGUAGE,
    name: 'SASS',
    version: null,
    icon: null,
    description: null,
    url: 'https://sass-lang.com/',
    depend_tools: [CSS],
    developed_platforms: CSS.developed_platforms
}

export const Tailwind: Tool = {
    type: ToolType.OTHER,
    name: 'Tailwind',
    version: null,
    icon: null,
    description: null,
    url: 'https://tailwindcss.com/',
    depend_tools: [SASS],
    developed_platforms: SASS.developed_platforms
}

export const Bootstrap: Tool = {
    type: ToolType.OTHER,
    name: 'Bootstrap',
    version: null,
    icon: null,
    description: null,
    url: 'https://getbootstrap.com/',
    depend_tools: [CSS],
    developed_platforms: CSS.developed_platforms
}

// FLUTTER

export const Dart: Tool = {
    type: ToolType.LANGUAGE,
    name: 'Dart',
    version: '2 - 3',
    icon: null,
    description: null,
    url: 'https://dart.dev/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.MOBILE, ToolPlatform.DESKTOP]
}

export const Flutter: Tool = {
    type: ToolType.FRAMEWORK,
    name: 'Flutter',
    version: '2 - 3',
    icon: null,
    description: null,
    url: 'https://flutter.dev/',
    depend_tools: [Dart],
    developed_platforms: Dart.developed_platforms
}

// RUST

export const Rust: Tool = {
    type: ToolType.LANGUAGE,
    name: 'Rust',
    version: 'Édition 2018, 2021',
    icon: null,
    description: null,
    url: 'https://www.rust-lang.org/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.SYSTEM, ToolPlatform.WEB_FRONT, ToolPlatform.WEB_BACK]
}

// 3D

export const Java: Tool = {
    type: ToolType.LANGUAGE,
    name: 'Java',
    version: '5 - 8',
    icon: null,
    description: null,
    url: 'https://www.java.com/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.MOBILE, ToolPlatform.WEB_BACK, ToolPlatform.DESKTOP]
}

export const OpenGL: Tool = {
    type: ToolType.OTHER,
    name: 'OpenGL',
    version: '<= 4.0',
    icon: null,
    description: null,
    url: 'https://www.opengl.org/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.DESKTOP]
}

export const LWJGL: Tool = {
    type: ToolType.LIB_OR_PACKAGE,
    name: 'LWJGL',
    version: '2 et 3',
    icon: null,
    description: null,
    url: 'https://www.opengl.org/',
    depend_tools: [Java, OpenGL],
    developed_platforms: [ToolPlatform.DESKTOP]
}

export const CSharp: Tool = {
    type: ToolType.LANGUAGE,
    name: 'C#',
    version: null,
    icon: null,
    description: null,
    url: 'https://www.microsoft.com',
    depend_tools: [],
    developed_platforms: [ToolPlatform.DESKTOP, ToolPlatform.MOBILE, ToolPlatform.WEB_FRONT]
}

export const Unity3D: Tool = {
    type: ToolType.OTHER,
    name: 'Unity3D',
    version: '2018-2019',
    icon: null,
    description: null,
    url: 'https://unity.com/',
    depend_tools: [CSharp, OpenGL],
    developed_platforms: CSharp.developed_platforms
}

export const GodotEngine: Tool = {
    type: ToolType.OTHER,
    name: 'GodotEngine',
    version: '3.x',
    icon: null,
    description: null,
    url: 'https://godotengine.org/',
    depend_tools: [CSharp, OpenGL],
    developed_platforms: CSharp.developed_platforms
}

// Builder

export const Webpack: Tool = {
    type: ToolType.OTHER,
    name: 'Webpack',
    version: null,
    icon: null,
    description: null,
    url: 'https://webpack.js.org/',
    depend_tools: [],
    developed_platforms: CSS.developed_platforms
}

export const Vite: Tool = {
    type: ToolType.OTHER,
    name: 'Vite',
    version: null,
    icon: null,
    description: null,
    url: 'https://vitejs.dev/',
    depend_tools: [],
    developed_platforms: CSS.developed_platforms
}

export const RequireJS: Tool = {
    type: ToolType.OTHER,
    name: 'RequireJS',
    version: null,
    icon: null,
    description: null,
    url: 'https://requirejs.org/',
    depend_tools: [],
    developed_platforms: CSS.developed_platforms
}

// Other

export const SteamAPI: Tool = {
    type: ToolType.LIB_OR_PACKAGE,
    name: 'SteamAPI',
    version: null,
    icon: null,
    description: null,
    url: 'https://steamcommunity.com/dev',
    depend_tools: [],
    developed_platforms: Unity3D.developed_platforms
}

export const MIDI: Tool = {
    type: ToolType.OTHER,
    name: 'MIDI',
    version: null,
    icon: null,
    description: null,
    url: 'https://en.wikipedia.org/wiki/MIDI',
    depend_tools: [],
    developed_platforms: Unity3D.developed_platforms
}

export const Cordova: Tool = {
    type: ToolType.OTHER,
    name: 'Cordova',
    version: null,
    icon: null,
    description: null,
    url: 'https://cordova.apache.org/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.MOBILE]
}

export const Electron: Tool = {
    type: ToolType.OTHER,
    name: 'Electron',
    version: null,
    icon: null,
    description: null,
    url: 'https://www.electronjs.org/',
    depend_tools: [],
    developed_platforms: [ToolPlatform.DESKTOP]
}