can you rewrite this powershell script to a powershell form application? # Functions
function RestartOption {
        # After the main logic, ask the user if they want to start over or make a new choice
    Write-Host "Do you want to start over or make a new choice?"
    Write-Host "1. Start with new IMSI or ICCID assignment" -ForegroundColor Orange -BackgroundColor Black
    Write-Host "2. Create another batch for the existing IMSI or ICCID" -ForegroundColor Green -BackgroundColor Red
    Write-Host "3. Exit" -ForegroundColor Red -BackgroundColor White

    $userChoice = Read-Host "Enter your choice (1-3)"
    switch ($userChoice) {
        "1" { Main-Menu }
        "2" { Display-MenuChoices }
        "3" { Exit-Script }
        default { Write-Host "Invalid choice. Exiting script."; exit }
}
}
function Display-MenuChoices {
# Menu for additional choices
Write-Host "Please select an option:"
Write-Host "1. Change State" -ForegroundColor Red -BackgroundColor White
Write-Host "2. Change Service Profile"
Write-Host "3. Add static IP" -ForegroundColor Red -BackgroundColor White
Write-Host "4. Move SIM to Customer"
Write-Host "5. Change customer attributes" -ForegroundColor Red -BackgroundColor White
Write-Host "6. Add static IP for APN"
$choice = Read-Host "Enter your choice (1-6)"
switch ($choice) {
    "1" { Change-State }
    "2" { Change-ServiceProfile }
    "3" { Add-StaticIP }
    "4" { Move-SIMToCustomer }
    "5" { Change-CustomerAttributes }
    "6" { Add-StaticIPForAPN }
    default { Write-Host "Invalid choice." }
}
}
function Exit-Script {
    # Exit the script
    Write-Host "Exiting script."
    exit
}

function Increment-IPAddress {
    param (
        [Parameter(Mandatory=$true)]
        [string]$ip
    )

    $ipParts = $ip -split '\.' | ForEach-Object { [int]$_ }
    for ($i = 3; $i -ge 0; $i--) {
        if ($ipParts[$i] -lt 255) {
            $ipParts[$i]++
            break
        } else {
            $ipParts[$i] = 0
            if ($i -eq 0) {
                throw "IP address overflow. Cannot increment beyond 255.255.255.255"
            }
        }
    }
    return $ipParts -join '.'
}
# Luhn Algorithm Functions
function Get-LuhnChecksum {
    param (
        [string]$code
    )
    $len = $code.Length
    $parity = $len % 2
    $sum = 0
    for ($i = $len - 1; $i -ge 0; $i--) {
        $d = [int]::Parse($code[$i])
        if ($i % 2 -eq $parity) { $d *= 2 }
        if ($d -gt 9) { $d -= 9 }
        $sum += $d
    }
    return $sum % 10
}
function Get-LuhnFullCode {
    param (
        [string]$partCode
    )
    $checksum = Get-LuhnChecksum ($partCode + "0")
    if ($checksum -eq 0) { return 0 } else { return 10 - $checksum }
}

function Test-LuhnCode {
    param (
        [string]$fullCode
    )
    return (Get-LuhnChecksum $fullCode) -eq 0
}

# Function to trim the last digit of an ICCID
function Trim-LastDigit {
    param (
        [string]$number
    )

    # Convert the number to a string, remove the last character, and return the modified string
    return $number.Substring(0, $number.Length - 1)
}

function Change-ServiceProfile {
    # Ask the user for the target Service Profile
    $targetServiceProfile = Read-Host "What is your target Service Profile?"

    # Define the header
    $header = "FORMAT01`tChange Device Service Profile`tCHANGE_SERVICE_PROFILE`n$inputType`tSERVICEPROFILE"

    # Create entries in the text file for each number with the target Service Profile
    $exportPath = "service_profile_change.txt"
    # Output the header to the file
    $header | Out-File -FilePath $exportPath

    # Initialize count variable
    $count = 0

    $rangeList | ForEach-Object {
        "$_`t$targetServiceProfile" | Out-File -FilePath $exportPath -Append
        $count++
    }

    # Define and output the footer with the count to the file
    $footer = "END`t$count"
    $footer | Out-File -FilePath $exportPath -Append

    Write-Host "Service Profile change entries have been added to the file: $exportPath"
    # call function Restart
    RestartOption
}

function Add-StaticIP {
    # Ask the user for the starting IP address
    $startingIP = Read-Host "What is your starting IP address?"

    # Define the header
    $header = "FORMAT01`tUpdate SIM Static IP Address`tUPDATE_ATTRIBUTES`n$inputType`tSTATICIPADDRESS"

    # Create entries in the text file for each number with the incremented IP address
    $exportPath = "static_ip_addition.txt"
    # Output the header to the file
    $header | Out-File -FilePath $exportPath

    # Initialize count variable
    $count = 0
    $currentIP = $startingIP

    $rangeList | ForEach-Object {
        "$_`t$currentIP" | Out-File -FilePath $exportPath -Append
        $currentIP = Increment-IPAddress -ip $currentIP
        $count++
    }

    # Define and output the footer with the count to the file
    $footer = "END`t$count"
    $footer | Out-File -FilePath $exportPath -Append

    Write-Host "Static IP addition entries have been added to the file: $exportPath"
    RestartOption
}

function Move-SIMToCustomer {
    # Ask the user for the target Service Profile and target customer
	$targetCustomer = Read-Host "Please provide your target customer?"    
	$targetServiceProfile = Read-Host "What is your target Service Profile?"
    # Define the header
    $header = "FORMAT01`tChange Device Service Profile`tCHANGE_SERVICE_PROFILE`n$inputType`tSERVICEPROFILE`tTARGET_CUSTOMER_NAME"

    # Create entries in the text file for each number with the target Service Profile
    $exportPath = "service_profile_change.txt"
    # Output the header to the file
    $header | Out-File -FilePath $exportPath

    # Initialize count variable
    $count = 0

    $rangeList | ForEach-Object {
        "$_`t$targetServiceProfile`t$targetCustomer" | Out-File -FilePath $exportPath -Append
        $count++
    }

    # Define and output the footer with the count to the file
    $footer = "END`t$count"
    $footer | Out-File -FilePath $exportPath -Append

    Write-Host "Service Profile change entries have been added to the file: $exportPath"
    RestartOption
}

function Change-CustomerAttributes {
    # Ask the user for up to 5 attributes
    $attributes = @()
    for ($i = 1; $i -le 5; $i++) {
        $attribute = Read-Host "Enter attribute $i (leave empty if not applicable)"
        $attributes += $attribute
    }

    # Define the header
    $header = "FORMAT01`tUpdate Device Attributes`tUPDATE_ATTRIBUTES`n$inputType`tATTRIBUTE1`tATTRIBUTE2`tATTRIBUTE3`tATTRIBUTE4`tATTRIBUTE5"

    # Create entries in the text file for each ID with the attributes
    $exportPath = "customer_attributes_change.txt"
    # Output the header to the file
    $header | Out-File -FilePath $exportPath

    # Initialize count variable
    $count = 0

     $rangeList | ForEach-Object {
        $id = $_
        $attributeLine = "$id"
        foreach ($attr in $attributes) {
            $attributeLine += "`t$attr"
        }
        $attributeLine | Out-File -FilePath $exportPath -Append
        $count++
    }

    # Define and output the footer with the count to the file
    $footer = "END`t$count"
    $footer | Out-File -FilePath $exportPath -Append

    Write-Host "Customer Attributes change entries have been added to the file: $exportPath"
}

function Add-StaticIPForAPN {
    # Placeholder for Add Static IP for APN logic
    "Add Static IP for APN logic executed"
     RestartOption
}
function Change-State {
    # Define the header
    $header = "FORMAT01`tChange Device State`tCHANGE_STATE`n$inputType`tSTATE"

    # Ask the user to choose a state
    Write-Host "Please select a state for the numbers:"
    Write-Host "1. TEST"
    Write-Host "2. READY"
    Write-Host "3. LIVE"
    Write-Host "4. STANDBY"
    Write-Host "5. SUSPEND"
    Write-Host "6. INACTIVE_STOPPED"

    $stateChoice = Read-Host "Enter the number corresponding to the state (1-6)"
    $states = @("TEST", "READY", "LIVE", "STANDBY", "SUSPEND", "INACTIVE_STOPPED")
    $selectedState = $states[$stateChoice - 1]

    # Validate state choice
    if (-not $selectedState) {
        Write-Host "Invalid choice. Please enter a number from 1 to 6."
        exit
    }

    # Create entries in the text file for each number with the selected state
    $exportPath = "state_change.txt"
    # Output the header to the file
    $header | Out-File -FilePath $exportPath
    # Initialize count variable
    $count = 0
    $rangeList | ForEach-Object {
        "$_`t$selectedState" | Out-File -FilePath $exportPath -Append
	$count++
    }
    # Define and output the footer to the file
    $footer = "END`t$count"
    $footer | Out-File -FilePath $exportPath -Append
    Write-Host "State change entries have been added to the file: $exportPath"
    RestartOption
}


function Main-Menu {
# Ask the user to enter ICCID or IMSI
$inputType = Read-Host "Do you want to enter ICCID or IMSI? (Enter 'ICCID' or 'IMSI')"
$inputType = $inputType.ToUpper()

# Validate input
while ($inputType -ne "ICCID" -and $inputType -ne "IMSI") {
    $inputType = Read-Host "Do you want to enter ICCID or IMSI? (Enter 'ICCID' or 'IMSI')"
    $inputType = $inputType.ToUpper()

    if ($inputType -ne "ICCID" -and $inputType -ne "IMSI") {
        Write-Host "Invalid input. Please enter 'ICCID' or 'IMSI'."
    }
}

# Get starting number
$startNumber = Read-Host "Enter the starting $inputType"
$startNumber = [System.Numerics.BigInteger]::Parse($startNumber)

# Get ending number
$endNumber = Read-Host "Enter the ending $inputType"
$endNumber = [System.Numerics.BigInteger]::Parse($endNumber)

# Validate range loop
while ($startNumber -gt $endNumber) {
    Write-Host "The starting number must be less than the ending number."
	# Get starting number
	$startNumber = Read-Host "Enter the starting $inputType"

	# Get ending number
	$endNumber = Read-Host "Enter the ending $inputType"
}
# Trim the last digit if the input type is ICCID
if ($inputType -eq "ICCID") {
    $startNumber = Trim-LastDigit -number $startNumber
    $endNumber = Trim-LastDigit -number $endNumber
}
$endNumber = [System.Numerics.BigInteger]::Parse($endNumber)
$startNumber = [System.Numerics.BigInteger]::Parse($startNumber)

# Create and populate the range list
$rangeList = New-Object System.Collections.Generic.List[System.Numerics.BigInteger]

#Fill the Textsheet with values
# call luhn
if ($inputType -eq "ICCID") {
for ($id = $startNumber; $id.CompareTo($endNumber) -le 0; $id = $id + [System.Numerics.BigInteger]::One) {
    $luhnDigit = Get-LuhnFullCode $id
    $fullId = "$id$luhnDigit"
    $rangeList.Add($fullId)
}
}else 
{
for ($id = $startNumber; $id.CompareTo($endNumber) -le 0; $id = $id + [System.Numerics.BigInteger]::One) {
    $rangeList.Add($id)
}
}


# Output the result
Write-Host "The range list of $inputType`s from $startNumber to $endNumber has been created with $($rangeList.Count) items."

# Menu for additional choices
Write-Host "Please select an option:"
Write-Host "1. Change State"
Write-Host "2. Change Service Profile"
Write-Host "3. Add static IP"
Write-Host "4. Move SIM to Customer"
Write-Host "5. Change customer attributes"
Write-Host "6. Add static IP for APN"
# Call menu function
Display-MenuChoices


    # After the main logic, ask the user if they want to start over or make a new choice
    Write-Host "Do you want to start over or make a new choice?"
    Write-Host "1. Start with new IMSI or ICCID assignment" -ForegroundColor Green
    Write-Host "2. Create another batch for the existing IMSI or ICCID" -ForegroundColor Blue
    Write-Host "3. Exit" -ForegroundColor Red

    $userChoice = Read-Host "Enter your choice (1-3)"
    switch ($userChoice) {
        "1" { Main-Menu }
        "2" { Display-MenuChoices }
        "3" { Exit-Script }
        default { Write-Host "Invalid choice. Exiting script."; exit }
}
}

Main-Menu