MOX_glow_color = {r = 1,g = 1,b = 1,a = 1}
sulfuric_base_color = data.raw.fluid["sulfuric-acid"].base_color
sulfuric_flow_color = data.raw.fluid["sulfuric-acid"].flow_color
uranium_hex_base_color = {r = 0.5,g = 0.5,b = 0.5}
uranium_hex_flow_color = {r = 0.5,g = 0.5,b = 0.5}
plutonium_hex_base_color = {r= 100,g = 10,b = 10,a = 150}
plutonium_hex_flow_color = {r= 100,g = 10,b = 10,a = 25}
oxide_color_table = {
	-- NU = {r=139,g=69,b=19},
	NU = {r = 0,g = 200,b = 255},
	DU = {r = 16, g = 16, b = 16},
	LEU = {r = 210, g = 210, b = 210},
	HEU = {r = 255, g = 255, b = 255},
	-- WGU = {r = 224, g = 224, b = 224},
	-- RGPu = {r = 0, g = 153, b = 0},
	RGPu = {r = 0, g = 153, b = 0},
	WGU = {r = 0, g = 255, b = 0},
}
oxide_color_table["LEU-PUREX"] = {r=150,g=0,b=150}
oxide_color_table["HEU-PUREX"] = {r=200,g=0,b=0}
LEU_slurry_base_color = adamo.colors.darkbrown
LEU_slurry_flow_color = oxide_color_table["LEU-PUREX"]
HEU_slurry_base_color = adamo.colors.darkbrown
HEU_slurry_flow_color = oxide_color_table["HEU-PUREX"]
pg_flow_color = data.raw.fluid["petroleum-gas"].flow_color
pg_base_color = data.raw.fluid["petroleum-gas"].base_color

natural_hex_fluid = {
    type = "fluid",
    name = "adamo-nuclear-natural-uranium-hex",
    subgroup = hex_subgroup.name,
    order = "n0",
    icon = "__adamo-nuclear__/graphics/icons/hex.png",
    icon_size = 32,
    base_color = uranium_hex_base_color,
    flow_color = oxide_color_table.NU,
    default_temperature = 25,
    max_temperature = 100,
    heat_capacity = "0.1KJ",
}
LEU_slurry = {
type = "fluid",
name = "adamo-nuclear-LEU-slurry",
subgroup = slurry_group.name,
order = "o1",
icon = "__adamo-nuclear__/graphics/icons/LEU-sludge.png",
icon_size = 32,
base_color = LEU_slurry_base_color,
flow_color = LEU_slurry_flow_color,
default_temperature = 25,
max_temperature = 100,
heat_capacity = "0.01KJ",
}
HEU_slurry = {
    type = "fluid",
    name = "adamo-nuclear-HEU-slurry",
    subgroup = slurry_group.name,
    order = "o2",
    icon = "__adamo-nuclear__/graphics/icons/HEU-sludge.png",
    icon_size = 32,
    base_color = HEU_slurry_base_color,
    flow_color = HEU_slurry_flow_color,
    default_temperature = 25,
    max_temperature = 100,
    heat_capacity = "0.1KJ",
}
urania_item = {
	type = "item",
	name = "adamo-nuclear-uranium-oxide",
	subgroup = processing_group.name,
	order = "n",
	stack_size = 50,
	icon = "__adamo-nuclear__/graphics/icons/urania.png",
	icon_size = 32,
}
LEU_fuel_item = {
	type = "item",
	name = "adamo-nuclear-LEU-fuel-cell",
	subgroup = fuel_group.name,
	order = "m",
	stack_size = 50,
	icon = "__adamo-nuclear__/graphics/icons/blue-fuel-cell.png",
	icon_size = 32,
	fuel_category = thermal_fuel_category.name,
	fuel_value = "62GJ",
	burnt_result = "adamo-nuclear-used-up-LEU-fuel-cell",
}
HEU_fuel_item = data.raw.item["uranium-fuel-cell"]
MOX_fuel_item = {
	type = "item",
	name = "adamo-nuclear-MOX-fuel-cell",
	subgroup = fuel_group.name,
	order = "o",
	stack_size = 50,
	icon = "__adamo-nuclear__/graphics/icons/cyan-fuel-cell.png",
	icon_size = 32,
	fuel_category = "nuclear",
	fuel_value = "162GJ",
	burnt_result = "adamo-nuclear-used-up-MOX-fuel-cell",
	fuel_glow_color = MOX_glow_color
}
WGPu_fuel_item = {
    type = "item",
    name = "adamo-nuclear-WGPu-fuel-cell",
    subgroup = products_group.name,
    order = "w",
    stack_size = 50,
    icon = "__adamo-nuclear__/graphics/icons/activated-green-fuel-cell.png",
    icon_size = 32,
}
used_LEU_item = {
	type = "item",
	name = LEU_fuel_item.burnt_result,
	subgroup = spent_fuel_group.name,
	order = "m1",
	stack_size = 50,
	icon = "__adamo-nuclear__/graphics/icons/purple-fuel-cell.png",
	icon_size = 32,
}
used_HEU_item = data.raw.item["used-up-uranium-fuel-cell"]
used_MOX_item = {
	type = "item",
	name = MOX_fuel_item.burnt_result,
	subgroup = spent_fuel_group.name,
	order = "m3",
	stack_size = 50,
	icon = "__adamo-nuclear__/graphics/icons/brown-fuel-cell.png",
	icon_size = 32,
}
actinides_item = {
	type = "item",
	name = "adamo-nuclear-actinides",
	subgroup = reprocessing_group.name,
	order = "p",
	stack_size = 50,
	icon = "__adamo-nuclear__/graphics/icons/actinides.png",
	icon_size = 32,	
}
waste_item = {
	type = "item",
	name = "adamo-nuclear-ceramic-waste",
	subgroup = reprocessing_group.name,
	order = "w",
	stack_size = 50,
	icon = "__adamo-nuclear__/graphics/icons/ceramic-waste.png",
	icon_size = 64,	
}

local order_number = 1
for _,grade in pairs({
	"LEU","HEU","WGU","DU","LEU-PUREX","HEU-PUREX"
}) do
	local oxide_color = oxide_color_table[grade]
	local hex_color = uranium_hex_base_color
	local item = {
		type = "item",
		name = "adamo-nuclear-"..grade.."-oxide",
		subgroup = recovery_group.name,
		order = "nz"..order_number.."a",
		stack_size = 50,
		icon = "__adamo-nuclear__/graphics/icons/"..grade..".png",
		icon_size = 32,
	}
	local fluid = {
		type = "fluid",
		name = "adamo-nuclear-"..grade.."-hex",
		subgroup = enrichment_group.name,
		order = "nz"..order_number.."b",
		icon = "__adamo-nuclear__/graphics/icons/"..grade.."-hex.png",
		icon_size = 32,
		base_color = hex_color,
		flow_color = oxide_color,
		default_temperature = 25,
		max_temperature = 100,
		heat_capacity = "0.1KJ",

	}
	if grade:match "PUREX" then
		item.subgroup = processing_group.name
		fluid.subgroup = processing_group.name
	end
	data:extend({item,fluid})
	order_number = order_number + 1
end


for _,grade in pairs({
	"LEU","HEU","WGU","DU","LEU-PUREX","HEU-PUREX"
}) do
	local oxide_color = oxide_color_table[grade]
	local hex_color = uranium_hex_base_color
	local hex_flow_color = uranium_hex_flow_color
	local oxide_recipe = {
		type = "recipe",
		category = "chemistry",
		name = "adamo-nuclear-"..grade.."-oxide",
		main_product = "adamo-nuclear-"..grade.."-oxide",
		enabled = false,
		energy_required = 10,
		always_show_made_in = true,
		ingredients = {{
				type = "fluid",
				name = "adamo-nuclear-"..grade.."-hex",
				amount = 10
			},{
				type = "fluid",
				name = "water",
				amount = 100
		}},
		results = {{
				type = "fluid",
				name = "adamo-chemical-hydrofluoric-acid",
				amount = 60,
			},{
				type = "item",
				name = "adamo-nuclear-"..grade.."-oxide",
				amount = 1
		}},
		crafting_machine_tint = {
			primary = hex_color,
			secondary = oxide_color,
			tertiary = hex_flow_color,
			quaternary = oxide_color
		},
	}
	local hex_recipe = {
		type = "recipe",
		name = "adamo-nuclear-"..grade.."-hex",
		category = "chemistry",
		enabled = false,
		energy_required = 10,
		always_show_made_in = true,
		main_product = "adamo-nuclear-"..grade.."-hex",
		ingredients = {{
				type = "item",
				name = "adamo-nuclear-"..grade.."-oxide",
				amount = 1
			},{
				type = "fluid",
				name = "adamo-chemical-hydrofluoric-acid",
				amount = 60
			},{
				type = "fluid",
				name = "water",
				amount = 100
		}},
		results = {{
				type = "fluid",
				name = "adamo-nuclear-"..grade.."-hex",
				amount = 10
		}},
		hide_from_player_crafting = true,
		crafting_machine_tint = {
			primary = hex_color,
			secondary = oxide_color,
			tertiary = adamo.colors.hf_flow,
			quaternary = oxide_color
		},
	}
	if grade:match "PUREX" then
		hex_recipe.hide_from_player_crafting = false
		oxide_recipe.hide_from_player_crafting = true
		adamo.tech.add.recipe("nuclear-fuel-reprocessing",hex_recipe)
		adamo.tech.add.recipe("nuclear-fuel-reprocessing",oxide_recipe)
	elseif grade:match "LEU" or grade:match "DU" then
		adamo.tech.add.recipe("uranium-processing",oxide_recipe)
		adamo.tech.add.recipe("uranium-processing",hex_recipe)
	else
		adamo.tech.add.recipe("nuclear-power",oxide_recipe)
		adamo.tech.add.recipe("nuclear-power",hex_recipe)
	end
	data:extend({hex_recipe,oxide_recipe})
end


data:extend({
    {
        type = "item",
        name = "adamo-nuclear-RGPu-oxide",
        subgroup = processing_group.name,
        order = "nz"..order_number,
        stack_size = 50,
        icon = "__adamo-nuclear__/graphics/icons/RGPu.png",
        icon_size = 32,
    },
    {
        type = "item",
        name = "adamo-nuclear-Pu238-oxide",
        subgroup = products_group.name,
        order = "m",
        stack_size = 50,
        icon = "__adamo-nuclear__/graphics/icons/Pu238.png",
        icon_size = 32,
    }
})
order_number = order_number + 1

local grade = "DU"
data.raw.recipe["adamo-nuclear-"..grade.."-oxide"].ingredients = {{
		type = "fluid",
		name = "water",
		amount = 30
	},{
		type = "fluid",
		name = "adamo-nuclear-"..grade.."-hex",
		amount = 10
}}
