import { flattenDeep } from 'lodash-es';

export const dataTypeCategories = [
	{
		name: 'Time',
		formats: [
			{ name: 'Hertz (1/s)', id: 'hertz' },
			{ name: 'nanoseconds (ns)', id: 'ns' },
			{ name: 'microseconds (µs)', id: 'µs' },
			{ name: 'milliseconds (ms)', id: 'ms' },
			{ name: 'seconds (s)', id: 's' },
			{ name: 'minutes (m)', id: 'm' },
			{ name: 'hours (h)', id: 'h' },
			{ name: 'days (d)', id: 'd' },
			{ name: 'duration (ms)', id: 'dtdurationms' },
			{ name: 'duration (s)', id: 'dtdurations' },
			{ name: 'duration (hh:mm:ss)', id: 'dthms' },
			{ name: 'duration (d hh:mm:ss)', id: 'dtdhms' },
			{ name: 'Timeticks (s/100)', id: 'timeticks' },
			{ name: 'clock (ms)', id: 'clockms' },
			{ name: 'clock (s)', id: 'clocks' },
		],
	},
	{
		name: 'Throughput',
		formats: [
			{ name: 'counts/sec (cps)', id: 'cps' },
			{ name: 'ops/sec (ops)', id: 'ops' },
			{ name: 'requests/sec (rps)', id: 'reqps' },
			{ name: 'reads/sec (rps)', id: 'rps' },
			{ name: 'writes/sec (wps)', id: 'wps' },
			{ name: 'I/O ops/sec (iops)', id: 'iops' },
			{ name: 'counts/min (cpm)', id: 'cpm' },
			{ name: 'ops/min (opm)', id: 'opm' },
			{ name: 'reads/min (rpm)', id: 'rpm' },
			{ name: 'writes/min (wpm)', id: 'wpm' },
		],
	},
	{
		name: 'Data',
		formats: [
			{ name: 'bytes(IEC)', id: 'bytes' },
			{ name: 'bytes(SI)', id: 'decbytes' },
			{ name: 'bits(IEC)', id: 'bits' },
			{ name: 'bits(SI)', id: 'decbits' },
			{ name: 'kibibytes', id: 'kbytes' },
			{ name: 'kilobytes', id: 'deckbytes' },
			{ name: 'mebibytes', id: 'mbytes' },
			{ name: 'megabytes', id: 'decmbytes' },
			{ name: 'gibibytes', id: 'gbytes' },
			{ name: 'gigabytes', id: 'decgbytes' },
			{ name: 'tebibytes', id: 'tbytes' },
			{ name: 'terabytes', id: 'dectbytes' },
			{ name: 'pebibytes', id: 'pbytes' },
			{ name: 'petabytes', id: 'decpbytes' },
		],
	},
	{
		name: 'Data rate',
		formats: [
			{ name: 'packets/sec', id: 'pps' },
			{ name: 'bytes/sec(IEC)', id: 'binBps' },
			{ name: 'bytes/sec(SI)', id: 'Bps' },
			{ name: 'bits/sec(IEC)', id: 'binbps' },
			{ name: 'bits/sec(SI)', id: 'bps' },
			{ name: 'kibibytes/sec', id: 'KiBs' },
			{ name: 'kibibits/sec', id: 'Kibits' },
			{ name: 'kilobytes/sec', id: 'KBs' },
			{ name: 'kilobits/sec', id: 'Kbits' },
			{ name: 'mebibytes/sec', id: 'MiBs' },
			{ name: 'mebibits/sec', id: 'Mibits' },
			{ name: 'megabytes/sec', id: 'MBs' },
			{ name: 'megabits/sec', id: 'Mbits' },
			{ name: 'gibibytes/sec', id: 'GiBs' },
			{ name: 'gibibits/sec', id: 'Gibits' },
			{ name: 'gigabytes/sec', id: 'GBs' },
			{ name: 'gigabits/sec', id: 'Gbits' },
			{ name: 'tebibytes/sec', id: 'TiBs' },
			{ name: 'tebibits/sec', id: 'Tibits' },
			{ name: 'terabytes/sec', id: 'TBs' },
			{ name: 'terabits/sec', id: 'Tbits' },
			{ name: 'pebibytes/sec', id: 'PiBs' },
			{ name: 'pebibits/sec', id: 'Pibits' },
			{ name: 'petabytes/sec', id: 'PBs' },
			{ name: 'petabits/sec', id: 'Pbits' },
		],
	},
	{
		name: 'Hash rate',
		formats: [
			{ name: 'hashes/sec', id: 'Hs' },
			{ name: 'kilohashes/sec', id: 'KHs' },
			{ name: 'megahashes/sec', id: 'MHs' },
			{ name: 'gigahashes/sec', id: 'GHs' },
			{ name: 'terahashes/sec', id: 'THs' },
			{ name: 'petahashes/sec', id: 'PHs' },
			{ name: 'exahashes/sec', id: 'EHs' },
		],
	},
	{
		name: 'Misc',
		formats: [
			{ name: 'none', id: 'none' },
			{ name: 'String', id: 'string' },
			{ name: 'short', id: 'short' },
			{ name: 'Percent (0-100)', id: 'percent' },
			{ name: 'Percent (0.0-1.0)', id: 'percentunit' },
			{ name: 'Humidity (%H)', id: 'humidity' },
			{ name: 'Decibel', id: 'dB' },
			{ name: 'Hexadecimal (0x)', id: 'hex0x' },
			{ name: 'Hexadecimal', id: 'hex' },
			{ name: 'Scientific notation', id: 'sci' },
			{ name: 'Locale format', id: 'locale' },
			{ name: 'Pixels', id: 'pixel' },
		],
	},
	{
		name: 'Acceleration',
		formats: [
			{ name: 'Meters/sec²', id: 'accMS2' },
			{ name: 'Feet/sec²', id: 'accFS2' },
			{ name: 'G unit', id: 'accG' },
		],
	},
	{
		name: 'Angle',
		formats: [
			{ name: 'Degrees (°)', id: 'degree' },
			{ name: 'Radians', id: 'radian' },
			{ name: 'Gradian', id: 'grad' },
			{ name: 'Arc Minutes', id: 'arcmin' },
			{ name: 'Arc Seconds', id: 'arcsec' },
		],
	},
	{
		name: 'Area',
		formats: [
			{ name: 'Square Meters (m²)', id: 'areaM2' },
			{ name: 'Square Feet (ft²)', id: 'areaF2' },
			{ name: 'Square Miles (mi²)', id: 'areaMI2' },
		],
	},
	{
		name: 'Computation',
		formats: [
			{ name: 'FLOP/s', id: 'flops' },
			{ name: 'MFLOP/s', id: 'mflops' },
			{ name: 'GFLOP/s', id: 'gflops' },
			{ name: 'TFLOP/s', id: 'tflops' },
			{ name: 'PFLOP/s', id: 'pflops' },
			{ name: 'EFLOP/s', id: 'eflops' },
			{ name: 'ZFLOP/s', id: 'zflops' },
			{ name: 'YFLOP/s', id: 'yflops' },
		],
	},
	{
		name: 'Concentration',
		formats: [
			{ name: 'parts-per-million (ppm)', id: 'ppm' },
			{ name: 'parts-per-billion (ppb)', id: 'conppb' },
			{ name: 'nanogram per cubic meter (ng/m³)', id: 'conngm3' },
			{ name: 'nanogram per normal cubic meter (ng/Nm³)', id: 'conngNm3' },
			{ name: 'microgram per cubic meter (μg/m³)', id: 'conμgm3' },
			{ name: 'microgram per normal cubic meter (μg/Nm³)', id: 'conμgNm3' },
			{ name: 'milligram per cubic meter (mg/m³)', id: 'conmgm3' },
			{ name: 'milligram per normal cubic meter (mg/Nm³)', id: 'conmgNm3' },
			{ name: 'gram per cubic meter (g/m³)', id: 'congm3' },
			{ name: 'gram per normal cubic meter (g/Nm³)', id: 'congNm3' },
			{ name: 'milligrams per decilitre (mg/dL)', id: 'conmgdL' },
			{ name: 'millimoles per litre (mmol/L)', id: 'conmmolL' },
		],
	},
	{
		name: 'Currency',
		formats: [
			{ name: 'Dollars ($)', id: 'currencyUSD' },
			{ name: 'Pounds (£)', id: 'currencyGBP' },
			{ name: 'Euro (€)', id: 'currencyEUR' },
			{ name: 'Yen (¥)', id: 'currencyJPY' },
			{ name: 'Rubles (₽)', id: 'currencyRUB' },
			{ name: 'Hryvnias (₴)', id: 'currencyUAH' },
			{ name: 'Real (R$)', id: 'currencyBRL' },
			{ name: 'Danish Krone (kr)', id: 'currencyDKK' },
			{ name: 'Icelandic Króna (kr)', id: 'currencyISK' },
			{ name: 'Norwegian Krone (kr)', id: 'currencyNOK' },
			{ name: 'Swedish Krona (kr)', id: 'currencySEK' },
			{ name: 'Czech koruna (czk)', id: 'currencyCZK' },
			{ name: 'Swiss franc (CHF)', id: 'currencyCHF' },
			{ name: 'Polish Złoty (PLN)', id: 'currencyPLN' },
			{ name: 'Bitcoin (฿)', id: 'currencyBTC' },
			{ name: 'Milli Bitcoin (฿)', id: 'currencymBTC' },
			{ name: 'Micro Bitcoin (฿)', id: 'currencyμBTC' },
			{ name: 'South African Rand (R)', id: 'currencyZAR' },
			{ name: 'Indian Rupee (₹)', id: 'currencyINR' },
			{ name: 'South Korean Won (₩)', id: 'currencyKRW' },
			{ name: 'Indonesian Rupiah (Rp)', id: 'currencyIDR' },
			{ name: 'Philippine Peso (PHP)', id: 'currencyPHP' },
			{ name: 'Vietnamese Dong (VND)', id: 'currencyVND' },
		],
	},

	{
		name: 'Date & time',
		formats: [
			{ name: 'Datetime ISO', id: 'dateTimeAsIso' },
			{
				name: 'Datetime ISO (No date if today)',
				id: 'dateTimeAsIsoNoDateIfToday',
			},
			{ name: 'Datetime US', id: 'dateTimeAsUS' },
			{ name: 'Datetime US (No date if today)', id: 'dateTimeAsUSNoDateIfToday' },
			{ name: 'Datetime local', id: 'dateTimeAsLocal' },
			{
				name: 'Datetime local (No date if today)',
				id: 'dateTimeAsLocalNoDateIfToday',
			},
			{ name: 'Datetime default', id: 'dateTimeAsSystem' },
			{ name: 'From Now', id: 'dateTimeFromNow' },
		],
	},
	{
		name: 'Energy',
		formats: [
			{ name: 'Watt (W)', id: 'watt' },
			{ name: 'Kilowatt (kW)', id: 'kwatt' },
			{ name: 'Megawatt (MW)', id: 'megwatt' },
			{ name: 'Gigawatt (GW)', id: 'gwatt' },
			{ name: 'Milliwatt (mW)', id: 'mwatt' },
			{ name: 'Watt per square meter (W/m²)', id: 'Wm2' },
			{ name: 'Volt-Ampere (VA)', id: 'voltamp' },
			{ name: 'Kilovolt-Ampere (kVA)', id: 'kvoltamp' },
			{ name: 'Volt-Ampere reactive (VAr)', id: 'voltampreact' },
			{ name: 'Kilovolt-Ampere reactive (kVAr)', id: 'kvoltampreact' },
			{ name: 'Watt-hour (Wh)', id: 'watth' },
			{ name: 'Watt-hour per Kilogram (Wh/kg)', id: 'watthperkg' },
			{ name: 'Kilowatt-hour (kWh)', id: 'kwatth' },
			{ name: 'Kilowatt-min (kWm)', id: 'kwattm' },
			{ name: 'Ampere-hour (Ah)', id: 'amph' },
			{ name: 'Kiloampere-hour (kAh)', id: 'kamph' },
			{ name: 'Milliampere-hour (mAh)', id: 'mamph' },
			{ name: 'Joule (J)', id: 'joule' },
			{ name: 'Electron volt (eV)', id: 'ev' },
			{ name: 'Ampere (A)', id: 'amp' },
			{ name: 'Kiloampere (kA)', id: 'kamp' },
			{ name: 'Milliampere (mA)', id: 'mamp' },
			{ name: 'Volt (V)', id: 'volt' },
			{ name: 'Kilovolt (kV)', id: 'kvolt' },
			{ name: 'Millivolt (mV)', id: 'mvolt' },
			{ name: 'Decibel-milliwatt (dBm)', id: 'dBm' },
			{ name: 'Ohm (Ω)', id: 'ohm' },
			{ name: 'Kiloohm (kΩ)', id: 'kohm' },
			{ name: 'Megaohm (MΩ)', id: 'Mohm' },
			{ name: 'Farad (F)', id: 'farad' },
			{ name: 'Microfarad (µF)', id: 'µfarad' },
			{ name: 'Nanofarad (nF)', id: 'nfarad' },
			{ name: 'Picofarad (pF)', id: 'pfarad' },
			{ name: 'Femtofarad (fF)', id: 'ffarad' },
			{ name: 'Henry (H)', id: 'henry' },
			{ name: 'Millihenry (mH)', id: 'mhenry' },
			{ name: 'Microhenry (µH)', id: 'µhenry' },
			{ name: 'Lumens (Lm)', id: 'lumens' },
		],
	},
	{
		name: 'Flow',
		formats: [
			{ name: 'Gallons/min (gpm)', id: 'flowgpm' },
			{ name: 'Cubic meters/sec (cms)', id: 'flowcms' },
			{ name: 'Cubic feet/sec (cfs)', id: 'flowcfs' },
			{ name: 'Cubic feet/min (cfm)', id: 'flowcfm' },
			{ name: 'Litre/hour', id: 'litreh' },
			{ name: 'Litre/min (L/min)', id: 'flowlpm' },
			{ name: 'milliLitre/min (mL/min)', id: 'flowmlpm' },
			{ name: 'Lux (lx)', id: 'lux' },
		],
	},
	{
		name: 'Force',
		formats: [
			{ name: 'Newton-meters (Nm)', id: 'forceNm' },
			{ name: 'Kilonewton-meters (kNm)', id: 'forcekNm' },
			{ name: 'Newtons (N)', id: 'forceN' },
			{ name: 'Kilonewtons (kN)', id: 'forcekN' },
		],
	},
	{
		name: 'Mass',
		formats: [
			{ name: 'milligram (mg)', id: 'massmg' },
			{ name: 'gram (g)', id: 'massg' },
			{ name: 'pound (lb)', id: 'masslb' },
			{ name: 'kilogram (kg)', id: 'masskg' },
			{ name: 'metric ton (t)', id: 'masst' },
		],
	},
	{
		name: 'Length',
		formats: [
			{ name: 'millimeter (mm)', id: 'lengthmm' },
			{ name: 'inch (in)', id: 'lengthin' },
			{ name: 'feet (ft)', id: 'lengthft' },
			{ name: 'meter (m)', id: 'lengthm' },
			{ name: 'kilometer (km)', id: 'lengthkm' },
			{ name: 'mile (mi)', id: 'lengthmi' },
		],
	},
	{
		name: 'Pressure',
		formats: [
			{ name: 'Millibars', id: 'pressurembar' },
			{ name: 'Bars', id: 'pressurebar' },
			{ name: 'Kilobars', id: 'pressurekbar' },
			{ name: 'Pascals', id: 'pressurepa' },
			{ name: 'Hectopascals', id: 'pressurehpa' },
			{ name: 'Kilopascals', id: 'pressurekpa' },
			{ name: 'Inches of mercury', id: 'pressurehg' },
			{ name: 'PSI', id: 'pressurepsi' },
		],
	},
	{
		name: 'Radiation',
		formats: [
			{ name: 'Becquerel (Bq)', id: 'radbq' },
			{ name: 'curie (Ci)', id: 'radci' },
			{ name: 'Gray (Gy)', id: 'radgy' },
			{ name: 'rad', id: 'radrad' },
			{ name: 'Sievert (Sv)', id: 'radsv' },
			{ name: 'milliSievert (mSv)', id: 'radmsv' },
			{ name: 'microSievert (µSv)', id: 'radusv' },
			{ name: 'rem', id: 'radrem' },
			{ name: 'Exposure (C/kg)', id: 'radexpckg' },
			{ name: 'roentgen (R)', id: 'radr' },
			{ name: 'Sievert/hour (Sv/h)', id: 'radsvh' },
			{ name: 'milliSievert/hour (mSv/h)', id: 'radmsvh' },
			{ name: 'microSievert/hour (µSv/h)', id: 'radusvh' },
		],
	},
	{
		name: 'Rotational Speed',
		formats: [
			{ name: 'Revolutions per minute (rpm)', id: 'rotrpm' },
			{ name: 'Hertz (Hz)', id: 'rothz' },
			{ name: 'Radians per second (rad/s)', id: 'rotrads' },
			{ name: 'Degrees per second (°/s)', id: 'rotdegs' },
		],
	},
	{
		name: 'Temperature',
		formats: [
			{ name: 'Celsius (°C)', id: 'celsius' },
			{ name: 'Fahrenheit (°F)', id: 'fahrenheit' },
			{ name: 'Kelvin (K)', id: 'kelvin' },
		],
	},
	{
		name: 'Velocity',
		formats: [
			{ name: 'meters/second (m/s)', id: 'velocityms' },
			{ name: 'kilometers/hour (km/h)', id: 'velocitykmh' },
			{ name: 'miles/hour (mph)', id: 'velocitymph' },
			{ name: 'knot (kn)', id: 'velocityknot' },
		],
	},
	{
		name: 'Volume',
		formats: [
			{ name: 'millilitre (mL)', id: 'mlitre' },
			{ name: 'litre (L)', id: 'litre' },
			{ name: 'cubic meter', id: 'm3' },
			{ name: 'Normal cubic meter', id: 'Nm3' },
			{ name: 'cubic decimeter', id: 'dm3' },
			{ name: 'gallons', id: 'gallons' },
		],
	},
	{
		name: 'Boolean',
		formats: [
			{ name: 'True / False', id: 'bool' },
			{ name: 'Yes / No', id: 'bool_yes_no' },
			{ name: 'On / Off', id: 'bool_on_off' },
		],
	},
];

export const flattenedCategories = flattenDeep(
	dataTypeCategories.map((category) => category.formats),
);
