public/Invoke-RemoveFootballCompetionData.ps1

function Invoke-RemoveFootballCompetionData {

    [CmdletBinding()]
    param(

        [Parameter(Mandatory=$true)]
        [ValidateSet('australia','europe','europe-uk','europe-uk-cup','europe-uk-fl','europe-uk-wsl','south-america','north-america','asia')]
        [string]$Continent,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Path,

        [Parameter(Mandatory=$true)]
        [ValidateSet('predictions','results')]
        [string]$Type

    )
    process{

        $ErrorActionPreference = 'Stop'

        try {

            $DateRange = Get-Content -Path "$Path\git-hub\sportsmonk-api\function-parameters\predictions-schedule.json" 
                | ConvertFrom-Json | Where-Object {$_.Enabled -eq 'true'}

            # 2025-07-20/2025-07-27 becocomes 2025-07-20
            $Date = $($DateRange.DateRange).Split('/')[0]

            # Result: "2025\07"
            $DateToUse = ($Date.Split('-'))[0..1] -join '\'

            # Media
            Remove-ProcessedFixtureLog -Continent $Continent -Date $DateToUse -Type media -Path $Path

            # Fixture log
            Remove-ProcessedFixtureLog -Continent $Continent -Date $DateToUse -Type $Type -Path $Path

            # Fixture files
            Remove-ProcessedFixtureData -Continent $Continent -StartDate $Date -Type prediction-preview -Path $Path
            Remove-ProcessedFixtureData -Continent $Continent -StartDate $Date -Type $Type -Path $Path

        }
        catch {

            "$($MyInvocation.MyCommand.Name): $_.Exception.Message"

        } # try catch


    } # process

} # function