jh_PizzaDoughRecipeCalculator.psm1

function Get-PizzaDoughRecipe {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [ValidateSet('Standard', 'Pizza')]
        [string]$OvenType,

        [Parameter(Mandatory)]
        [ValidateRange(1, 8)]
        [int]$NumPizzas,

        [Parameter()]
        [ValidateSet('Neapolitan')]
        [string]$PizzaType = 'Neapolitan',

        [Parameter()]
        [switch]$Display,

        [Parameter()]
        [switch]$PassThru
    )

    $recipeData = @(
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 1; DoughBallSizeGrams = 240; FlourGrams = 143; WaterGrams = 89; OilGrams = 4.3; SaltGrams = 2.9; DryYeastGrams = 0.11; SugarGrams = 1.4 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 1; DoughBallSizeGrams = 230; FlourGrams = 137; WaterGrams = 89; OilGrams = 0.0; SaltGrams = 3.4; DryYeastGrams = 0.10; SugarGrams = 0.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 2; DoughBallSizeGrams = 240; FlourGrams = 286; WaterGrams = 177; OilGrams = 8.6; SaltGrams = 5.7; DryYeastGrams = 0.21; SugarGrams = 2.9 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 2; DoughBallSizeGrams = 230; FlourGrams = 275; WaterGrams = 178; OilGrams = 0.0; SaltGrams = 6.9; DryYeastGrams = 0.20; SugarGrams = 0.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 3; DoughBallSizeGrams = 240; FlourGrams = 438; WaterGrams = 266; OilGrams = 12.9; SaltGrams = 8.6; DryYeastGrams = 0.32; SugarGrams = 4.3 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 3; DoughBallSizeGrams = 230; FlourGrams = 412; WaterGrams = 268; OilGrams = 0.0; SaltGrams = 10.3; DryYeastGrams = 0.30; SugarGrams = 0.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 4; DoughBallSizeGrams = 240; FlourGrams = 571; WaterGrams = 354; OilGrams = 17.1; SaltGrams = 11.4; DryYeastGrams = 0.42; SugarGrams = 5.7 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 4; DoughBallSizeGrams = 230; FlourGrams = 549; WaterGrams = 357; OilGrams = 0.0; SaltGrams = 13.7; DryYeastGrams = 0.41; SugarGrams = 0.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 5; DoughBallSizeGrams = 240; FlourGrams = 714; WaterGrams = 443; OilGrams = 21.4; SaltGrams = 14.3; DryYeastGrams = 0.53; SugarGrams = 7.1 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 5; DoughBallSizeGrams = 230; FlourGrams = 686; WaterGrams = 446; OilGrams = 0.0; SaltGrams = 17.2; DryYeastGrams = 0.51; SugarGrams = 0.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 6; DoughBallSizeGrams = 240; FlourGrams = 857; WaterGrams = 531; OilGrams = 25.7; SaltGrams = 17.1; DryYeastGrams = 0.63; SugarGrams = 8.6 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 6; DoughBallSizeGrams = 230; FlourGrams = 824; WaterGrams = 535; OilGrams = 0.0; SaltGrams = 20.6; DryYeastGrams = 0.61; SugarGrams = 0.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 7; DoughBallSizeGrams = 240; FlourGrams = 1000; WaterGrams = 620; OilGrams = 30.0; SaltGrams = 20.0; DryYeastGrams = 0.74; SugarGrams = 10.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 7; DoughBallSizeGrams = 230; FlourGrams = 961; WaterGrams = 625; OilGrams = 0.0; SaltGrams = 24.0; DryYeastGrams = 0.71; SugarGrams = 0.0 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Standard'; DegreesCelcius = '200-299'; NumPizzas = 8; DoughBallSizeGrams = 240; FlourGrams = 1142; WaterGrams = 708; OilGrams = 34.4; SaltGrams = 22.8; DryYeastGrams = 0.84; SugarGrams = 11.4 }
        [pscustomobject]@{ PizzaType = 'Neapolitan'; OvenType = 'Pizza'; DegreesCelcius = '300-500'; NumPizzas = 8; DoughBallSizeGrams = 230; FlourGrams = 1098; WaterGrams = 714; OilGrams = 0.0; SaltGrams = 27.5; DryYeastGrams = 0.81; SugarGrams = 0.0 }
    )

    $recipe = $recipeData | Where-Object {
        $_.PizzaType -eq $PizzaType -and
        $_.OvenType -eq $OvenType -and
        $_.NumPizzas -eq $NumPizzas
    }

    if (-not $recipe) {
        throw "No recipe found for PizzaType '$PizzaType', OvenType '$OvenType', NumPizzas '$NumPizzas'."
    }

    if ($Display) {
        $degreesFahrenheit = $recipe.DegreesCelcius

        if ($recipe.DegreesCelcius -match '^(\d+)-(\d+)$') {
            $celsiusMin = [int]$matches[1]
            $celsiusMax = [int]$matches[2]
            $fahrenheitMin = [math]::Round(($celsiusMin * 9 / 5) + 32)
            $fahrenheitMax = [math]::Round(($celsiusMax * 9 / 5) + 32)
            $degreesFahrenheit = '{0}-{1}' -f $fahrenheitMin, $fahrenheitMax
        }

        $displayObject = [pscustomobject]@{
            'Pizza Type' = $recipe.PizzaType
            'Oven Type' = $recipe.OvenType
            'Degrees Celsius' = $recipe.DegreesCelcius
            'Degrees Fahrenheit' = $degreesFahrenheit
            'Number Of Pizzas' = $recipe.NumPizzas
            'Dough Ball Size (g)' = $recipe.DoughBallSizeGrams
            'Flour (g)' = $recipe.FlourGrams
            'Water (g)' = $recipe.WaterGrams
            'Oil (g)' = $recipe.OilGrams
            'Salt (g)' = $recipe.SaltGrams
            'Dry Yeast (g)' = $recipe.DryYeastGrams
            'Sugar (g)' = $recipe.SugarGrams
        }

        $displayObject | Format-List | Out-Host
        Write-Host
        Write-Host 'To understand how to mix, proof and cook the dough please check: "https://jaredheinrichs.substack.com/publish/post/196901688"'

        if ($PassThru) {
            return $recipe
        }

        return
    }

    return $recipe
}

Export-ModuleMember -Function Get-PizzaDoughRecipe