Public/New-JoinableCollectionTemplate.ps1

<#
.SYNOPSIS
    Creates a new joinable collection template for the Fortytwo Collections API.

.DESCRIPTION
    This function creates a new joinable collection template for the Fortytwo Collections API.

#>

function New-JoinableCollectionTemplate {
    [CmdletBinding(SupportsShouldProcess = $true)]
    [OutputType([System.Collections.Hashtable])]
    param (
        [Parameter(Mandatory = $true)]
        [ValidateSet("User", "Group", "Organization", "Identity", "Relationship", "OrgUnit")]
        [string]$ObjectType,
        [Parameter(Mandatory = $true)]
        [string]$Name,
        [Parameter(Mandatory = $true)]
        [string]$Description,
        [Parameter(Mandatory = $false)]
        [bool]$ApprovalRequired = $false
    )

    process {
        @{
            objectType    = $ObjectType
            name          = $Name
            description   = $Description
            joinPolicy    = [ordered]@{
                approvalRequired      = $ApprovalRequired
                approverCollectionIds = @()
                approvalGates         = @()
                joinableBy = @{}
            }
            metadata = [ordered]@{
                tags = @()
                attributes = @{}
            }
        }
    }
}