Placements developer guide
    Preparing search index...

    Trusted server operations, not an authentication boundary. The placement operations expect callers to authorize reads and writes before invocation. The days-served and certificate operations resolve the principal's current Organization authority themselves, on the caller's transaction connection; commands hold their locks, facts, and history in that transaction. The concrete Layer captures Database; execute also retains callback requirements.

    interface PlacementsOperations {
        authorizeCertificateCommand: (
            principal: CertificatePrincipal,
            target:
                | {
                    departmentId: string & Brand<"DepartmentId">;
                    semesterId: string & Brand<"SemesterId">;
                }
                | {
                    departmentId: string & Brand<"DepartmentId">;
                    personId: string & Brand<"PersonId">;
                },
        ) => Effect<void, CertificateAuthorizationFailure>;
        confirmDaysServed: <E, R>(
            principal: CertificatePrincipal,
            command: {
                commandId: string;
                departmentId: string & Brand<"DepartmentId">;
                personId: string & Brand<"PersonId">;
                semesterId: string & Brand<"SemesterId">;
                total: number;
            },
            checkPrecondition: (
                current: {
                    calculated: number;
                    confirmation:
                        | {
                            calculated: number;
                            confirmationId: string & Brand<"DaysServedConfirmationId">;
                            confirmedAt: string;
                            confirmedBy: string & Brand<"PersonId">;
                            confirmedByName: string;
                            revision: number;
                            total: number;
                        }
                        | null;
                    departmentId: string & Brand<"DepartmentId">;
                    evidence: {
                        dates: readonly {
                            schools: readonly {
                                name: string;
                                schoolId: number & Brand<"SchoolId">;
                            }[];
                            serviceDate: string;
                        }[];
                        legacyTotals: readonly {
                            school: { name: string; schoolId: number & Brand<"SchoolId"> };
                            workdays: number;
                        }[];
                    };
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    revision: number;
                    semesterId: string & Brand<"SemesterId">;
                },
            ) => Effect<void, E, R>,
        ) => Effect<
            {
                calculated: number;
                confirmation: | {
                    calculated: number;
                    confirmationId: string & Brand<"DaysServedConfirmationId">;
                    confirmedAt: string;
                    confirmedBy: string & Brand<"PersonId">;
                    confirmedByName: string;
                    revision: number;
                    total: number;
                }
                | null;
                departmentId: string & Brand<"DepartmentId">;
                evidence: {
                    dates: readonly {
                        schools: readonly {
                            name: string;
                            schoolId: number & Brand<"SchoolId">;
                        }[];
                        serviceDate: string;
                    }[];
                    legacyTotals: readonly {
                        school: { name: string; schoolId: number & Brand<"SchoolId"> };
                        workdays: number;
                    }[];
                };
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                revision: number;
                semesterId: string & Brand<"SemesterId">;
            },
            DaysServedCommandFailure
            | E,
            R,
        >;
        execute: <E, R>(
            input: PlacementExecution,
            checkPrecondition: (current: PlacementSnapshot) => Effect<void, E, R>,
        ) => Effect<PlacementSnapshot, PlacementOperationFailure | E, R>;
        issueCertificate: <E, R>(
            principal: CertificatePrincipal,
            command: {
                commandId: string;
                departmentId: string & Brand<"DepartmentId">;
                personId: string & Brand<"PersonId">;
            },
            checkPrecondition: (
                current: {
                    assistantName: string;
                    content:
                        | {
                            assistantName: string;
                            departmentId: string & Brand<"DepartmentId">;
                            departmentName: string;
                            personId: string & Brand<"PersonId">;
                            semesters: readonly {
                                days: number;
                                endsOn: string;
                                schools: readonly string[];
                                semesterId: string & Brand<"SemesterId">;
                                startsOn: string;
                            }[];
                        }
                        | null;
                    contentSha256: string
                    | null;
                    departmentId: string & Brand<"DepartmentId">;
                    departmentName: string;
                    issuer: {
                        basis: "DerivedSeat" | "BoardSeat" | "GlobalAdministrator";
                        name: string;
                        personId: string & Brand<"PersonId">;
                        seatTitle: string;
                    };
                    personId: string & Brand<"PersonId">;
                    semesters: readonly {
                        calculated: number;
                        endsOn: string;
                        schools: readonly string[];
                        semesterId: string & Brand<"SemesterId">;
                        startsOn: string;
                        status: "Included" | "ConfirmedZero" | "Unconfirmed";
                        total: number | null;
                    }[];
                },
            ) => Effect<void, E, R>,
        ) => Effect<
            {
                content: {
                    assistantName: string;
                    departmentId: string & Brand<"DepartmentId">;
                    departmentName: string;
                    personId: string & Brand<"PersonId">;
                    semesters: readonly {
                        days: number;
                        endsOn: string;
                        schools: readonly string[];
                        semesterId: string & Brand<"SemesterId">;
                        startsOn: string;
                    }[];
                };
                contentSha256: string;
                issuedAt: string;
                issuedOn: string;
                issueId: string & Brand<"CertificateIssueId">;
                issuer: {
                    basis: "DerivedSeat" | "BoardSeat" | "GlobalAdministrator";
                    name: string;
                    personId: string & Brand<"PersonId">;
                    seatTitle: string;
                };
            },
            CertificateCommandFailure
            | E,
            R,
        >;
        listCertificates: (
            principal: CertificatePrincipal,
            departmentId: string & Brand<"DepartmentId">,
            cursor?: string,
        ) => Effect<CertificateAssistantPage, CertificateReadFailure>;
        listScopes: (
            authority: {
                delegations: readonly {
                    area: { departmentId: string & Brand<"DepartmentId"> } | {};
                    capability:
                        | "admissions.periods"
                        | "admissions.outcomes"
                        | "recruitment.interviews"
                        | "placements.coordinate"
                        | "placements.days-served"
                        | "schools.administer"
                        | "appointments.manage"
                        | "people.read"
                        | "team-interest.read"
                        | "content.publish"
                        | "receipts.approve"
                        | "receipts.settle"
                        | "delegations.manage"
                        | "organization.govern";
                    delegationId: string & Brand<"DelegationId">;
                    endAt: string | null;
                    holders: "AllMembers" | "LeadersOnly";
                    name: string;
                    revision: number;
                    startAt: string;
                    teamId: string & Brand<"TeamId">;
                }[];
                evaluatedAt: string;
                globalAdministrator: "Active"
                | "Inactive"
                | "Absent";
                memberships: readonly {
                    active: boolean;
                    departmentId: string & Brand<"DepartmentId">;
                    departmentIndependent: boolean;
                    membershipId: string & Brand<"MembershipId">;
                    teamId: string & Brand<"TeamId">;
                    teamScope: "National" | "HomeDepartment";
                    unitKind: "Team" | "DepartmentBoard";
                    unitLeader: boolean;
                }[];
                nationalBoardSeats: readonly {
                    active: boolean;
                    boardId: string;
                    membershipId: string & Brand<"MembershipId">;
                    unitLeader: boolean;
                }[];
                personId: string & Brand<"PersonId">;
            },
        ) => Effect<
            {
                departments: readonly {
                    canManage: boolean;
                    departmentId: string & Brand<"DepartmentId">;
                    name: string;
                }[];
                semesters: readonly {
                    endAt: string;
                    semesterId: string & Brand<"SemesterId">;
                    startAt: string;
                }[];
            },
            PlacementOperationFailure,
        >;
        readBoard: (
            scope: {
                departmentId: string & Brand<"DepartmentId">;
                semesterId: string & Brand<"SemesterId">;
            },
        ) => Effect<
            {
                affiliations: readonly {
                    departmentId: string & Brand<"DepartmentId">;
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    revision: number;
                    status: "Active" | "Inactive" | "Absent" | "Pending";
                }[];
                commitments: readonly {
                    assignments: readonly {
                        block: "1"
                        | "2";
                        day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                        firstName: string;
                        lastName: string;
                        personId: string & Brand<"PersonId">;
                        placementId: string;
                        schoolId: number & Brand<"SchoolId">;
                        schoolName: string;
                    }[];
                    block: "1"
                    | "2";
                    commitmentId: string;
                    createdAt: string;
                    createdBy: string & Brand<"PersonId">;
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    decision:
                        | {
                            attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                            decidedAt: string;
                            decidedBy: string & Brand<"PersonId">;
                            evidenceSource: string;
                            occurrenceId: string | null;
                            outcome: "Cancelled" | "Completed" | "Unfulfilled";
                            reason: string | null;
                        }
                        | null;
                    departmentId: string & Brand<"DepartmentId">;
                    endTime: string;
                    overdue: boolean;
                    proposalId: string;
                    requiredVolunteers: number;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    semesterId: string & Brand<"SemesterId">;
                    serviceDate: string;
                    startTime: string;
                }[];
                demands: readonly {
                    block: "1"
                    | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    requiredVolunteers: number;
                    revision: number;
                    schoolId: number & Brand<"SchoolId">;
                }[];
                departmentId: string & Brand<"DepartmentId">;
                notifications: readonly {
                    attempts: number;
                    deliveredAt: string | null;
                    effectId: string;
                    lastFailureTag: string | null;
                    personId: string & Brand<"PersonId">;
                    proposalId: string;
                    status:
                        | "Quarantined"
                        | "Pending"
                        | "Processing"
                        | "Delivered"
                        | "Failed";
                }[];
                occurrences: readonly {
                    attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                    block: "1" | "2";
                    commitmentId: string | null;
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    occurredOn: string;
                    occurrenceId: string;
                    proposalId: string;
                    recordedAt: string;
                    recordedBy: string & Brand<"PersonId">;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                placements: readonly {
                    active: boolean;
                    block: "1"
                    | "2"
                    | "Both";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    departmentId: string & Brand<"DepartmentId">;
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    placementId: string;
                    revision: number;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    semesterId: string & Brand<"SemesterId">;
                    workdays: number;
                }[];
                proposal: | {
                    assignments: readonly {
                        block: "1"
                        | "2";
                        day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                        firstName: string;
                        lastName: string;
                        personId: string & Brand<"PersonId">;
                        placementId: string;
                        schoolId: number & Brand<"SchoolId">;
                        schoolName: string;
                    }[];
                    confirmedAt: string
                    | null;
                    confirmedBy: string & Brand<"PersonId"> | null;
                    createdAt: string;
                    createdBy: string & Brand<"PersonId">;
                    demands: readonly {
                        block: "1" | "2";
                        day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                        requiredVolunteers: number;
                        revision: number;
                        schoolId: number & Brand<"SchoolId">;
                    }[];
                    exceptions: readonly {
                        assignedVolunteers: number;
                        block: "1"
                        | "2";
                        code: "DemandUnfilled" | "DemandExceeded" | "AssignmentWithoutDemand";
                        day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                        exceptionId: string;
                        requiredVolunteers: number;
                        schoolId: number & Brand<"SchoolId">;
                        schoolName: string;
                    }[];
                    proposalId: string;
                    reviewedExceptionIds: readonly string[];
                    revision: number;
                    status: "Draft"
                    | "Confirmed";
                }
                | null;
                schools: readonly { name: string; schoolId: number & Brand<"SchoolId"> }[];
                semesterId: string & Brand<"SemesterId">;
            },
            PlacementOperationFailure,
        >;
        readCertificate: (
            principal: CertificatePrincipal,
            departmentId: string & Brand<"DepartmentId">,
            personId: string & Brand<"PersonId">,
        ) => Effect<
            {
                assistantName: string;
                content: | {
                    assistantName: string;
                    departmentId: string & Brand<"DepartmentId">;
                    departmentName: string;
                    personId: string & Brand<"PersonId">;
                    semesters: readonly {
                        days: number;
                        endsOn: string;
                        schools: readonly string[];
                        semesterId: string & Brand<"SemesterId">;
                        startsOn: string;
                    }[];
                }
                | null;
                contentSha256: string
                | null;
                departmentId: string & Brand<"DepartmentId">;
                departmentName: string;
                issuer: {
                    basis: "DerivedSeat" | "BoardSeat" | "GlobalAdministrator";
                    name: string;
                    personId: string & Brand<"PersonId">;
                    seatTitle: string;
                };
                personId: string & Brand<"PersonId">;
                semesters: readonly {
                    calculated: number;
                    endsOn: string;
                    schools: readonly string[];
                    semesterId: string & Brand<"SemesterId">;
                    startsOn: string;
                    status: "Included" | "ConfirmedZero" | "Unconfirmed";
                    total: number | null;
                }[];
            },
            CertificateReadFailure,
        >;
        readCertificateScopes: (
            principal: CertificatePrincipal,
        ) => Effect<
            {
                departments: readonly {
                    confirmDaysServed: boolean;
                    departmentId: string & Brand<"DepartmentId">;
                    issueCertificates: boolean;
                    name: string;
                }[];
                semesters: readonly {
                    endAt: string;
                    semesterId: string & Brand<"SemesterId">;
                    startAt: string;
                }[];
            },
            CertificateReadFailure,
        >;
        readCoverageBoard: (
            scope: {
                departmentId: string & Brand<"DepartmentId">;
                semesterId: string & Brand<"SemesterId">;
            },
        ) => Effect<
            {
                absences: readonly {
                    absenceId: string;
                    block: "1"
                    | "2";
                    commitmentId: string | null;
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    departmentId: string & Brand<"DepartmentId">;
                    personId: string & Brand<"PersonId">;
                    proposalId: string;
                    reportedAt: string;
                    reporterPersonId: string & Brand<"PersonId">;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    semesterId: string & Brand<"SemesterId">;
                    serviceDate: string;
                }[];
                closures: readonly {
                    absenceId: string;
                    closedAt: string;
                    closedByPersonId: string & Brand<"PersonId">;
                    closureId: string;
                    coverageId: string | null;
                    coveringPersonId: string & Brand<"PersonId"> | null;
                    occurrenceId: string | null;
                    outcome: "Covered" | "Uncovered";
                    scheduledPersonId: string & Brand<"PersonId">;
                }[];
                commitments: readonly {
                    assignments: readonly {
                        block: "1"
                        | "2";
                        day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                        firstName: string;
                        lastName: string;
                        personId: string & Brand<"PersonId">;
                        placementId: string;
                        schoolId: number & Brand<"SchoolId">;
                        schoolName: string;
                    }[];
                    block: "1"
                    | "2";
                    commitmentId: string;
                    createdAt: string;
                    createdBy: string & Brand<"PersonId">;
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    decision:
                        | {
                            attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                            decidedAt: string;
                            decidedBy: string & Brand<"PersonId">;
                            evidenceSource: string;
                            occurrenceId: string | null;
                            outcome: "Cancelled" | "Completed" | "Unfulfilled";
                            reason: string | null;
                        }
                        | null;
                    departmentId: string & Brand<"DepartmentId">;
                    endTime: string;
                    overdue: boolean;
                    proposalId: string;
                    requiredVolunteers: number;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    semesterId: string & Brand<"SemesterId">;
                    serviceDate: string;
                    startTime: string;
                }[];
                coverage: readonly {
                    absenceId: string;
                    coverageId: string;
                    coveringFirstName: string;
                    coveringLastName: string;
                    coveringPersonId: string & Brand<"PersonId">;
                    recordedAt: string;
                    recordedByPersonId: string & Brand<"PersonId">;
                }[];
                coverers: readonly {
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                }[];
                departmentId: string & Brand<"DepartmentId">;
                occurrences: readonly {
                    attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                    block: "1" | "2";
                    commitmentId: string | null;
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    occurredOn: string;
                    occurrenceId: string;
                    proposalId: string;
                    recordedAt: string;
                    recordedBy: string & Brand<"PersonId">;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                rosterAssignments: readonly {
                    block: "1"
                    | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    placementId: string;
                    proposalId: string;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                semesterId: string & Brand<"SemesterId">;
            },
            PlacementOperationFailure,
        >;
        readDaysServed: (
            principal: CertificatePrincipal,
            scope: {
                departmentId: string & Brand<"DepartmentId">;
                semesterId: string & Brand<"SemesterId">;
            },
            cursor?: string,
        ) => Effect<DaysServedPage, CertificateReadFailure>;
        readDraft: (
            scope: {
                departmentId: string & Brand<"DepartmentId">;
                semesterId: string & Brand<"SemesterId">;
            },
        ) => Effect<
            {
                departmentId: string & Brand<"DepartmentId">;
                filledPlaces: number;
                openPlaces: number;
                openSlots: readonly {
                    block: "1" | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    places: number;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                placements: readonly {
                    block: "1"
                    | "2"
                    | "Both";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    wishes: {
                        language: "Norsk" | "Engelsk" | "Norsk og engelsk";
                        preferredSchool: string | null;
                    };
                    workdays: number;
                }[];
                semesterId: string & Brand<"SemesterId">;
                unplaced: readonly {
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    reason: "NoAvailability" | "NoOpenPlace";
                    wishes:
                        | {
                            language: "Norsk"
                            | "Engelsk"
                            | "Norsk og engelsk";
                            preferredSchool: string | null;
                        }
                        | null;
                }[];
            },
            PlacementOperationFailure,
        >;
        readOwnAffiliation: (
            personId: string & Brand<"PersonId">,
            departmentId: string & Brand<"DepartmentId">,
        ) => Effect<
            {
                departmentId: string & Brand<"DepartmentId">;
                personId: string & Brand<"PersonId">;
                revision: number;
                status: "Active" | "Inactive" | "Absent" | "Pending";
            },
            PlacementOperationFailure,
        >;
        readOwnCoverage: (
            scope: {
                departmentId: string & Brand<"DepartmentId">;
                semesterId: string & Brand<"SemesterId">;
            },
            personId: string & Brand<"PersonId">,
        ) => Effect<
            {
                absences: readonly {
                    absenceId: string;
                    block: "1"
                    | "2";
                    commitmentId: string | null;
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    departmentId: string & Brand<"DepartmentId">;
                    personId: string & Brand<"PersonId">;
                    proposalId: string;
                    reportedAt: string;
                    reporterPersonId: string & Brand<"PersonId">;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    semesterId: string & Brand<"SemesterId">;
                    serviceDate: string;
                }[];
                commitments: readonly {
                    assignments: readonly {
                        block: "1"
                        | "2";
                        day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                        firstName: string;
                        lastName: string;
                        personId: string & Brand<"PersonId">;
                        placementId: string;
                        schoolId: number & Brand<"SchoolId">;
                        schoolName: string;
                    }[];
                    block: "1"
                    | "2";
                    commitmentId: string;
                    createdAt: string;
                    createdBy: string & Brand<"PersonId">;
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    decision:
                        | {
                            attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                            decidedAt: string;
                            decidedBy: string & Brand<"PersonId">;
                            evidenceSource: string;
                            occurrenceId: string | null;
                            outcome: "Cancelled" | "Completed" | "Unfulfilled";
                            reason: string | null;
                        }
                        | null;
                    departmentId: string & Brand<"DepartmentId">;
                    endTime: string;
                    overdue: boolean;
                    proposalId: string;
                    requiredVolunteers: number;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    semesterId: string & Brand<"SemesterId">;
                    serviceDate: string;
                    startTime: string;
                }[];
                coverage: readonly {
                    absenceId: string;
                    coverageId: string;
                    coveringFirstName: string;
                    coveringLastName: string;
                    coveringPersonId: string & Brand<"PersonId">;
                    recordedAt: string;
                    recordedByPersonId: string & Brand<"PersonId">;
                }[];
                coverers: readonly {
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                }[];
                departmentId: string & Brand<"DepartmentId">;
                personId: string & Brand<"PersonId">;
                placements: readonly {
                    active: boolean;
                    block: "1" | "2" | "Both";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    departmentId: string & Brand<"DepartmentId">;
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    placementId: string;
                    revision: number;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                    semesterId: string & Brand<"SemesterId">;
                    workdays: number;
                }[];
                rosterSlots: readonly {
                    block: "1"
                    | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    proposalId: string;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                semesterId: string & Brand<"SemesterId">;
            },
            PlacementOperationFailure,
        >;
    }
    Index
    authorizeCertificateCommand: (
        principal: CertificatePrincipal,
        target:
            | {
                departmentId: string & Brand<"DepartmentId">;
                semesterId: string & Brand<"SemesterId">;
            }
            | {
                departmentId: string & Brand<"DepartmentId">;
                personId: string & Brand<"PersonId">;
            },
    ) => Effect<void, CertificateAuthorizationFailure>

    Resolves the principal's current authority for one days-served or certificate command on the caller's transaction, with the command's locks, before a stored response can replay.

    confirmDaysServed: <E, R>(
        principal: CertificatePrincipal,
        command: {
            commandId: string;
            departmentId: string & Brand<"DepartmentId">;
            personId: string & Brand<"PersonId">;
            semesterId: string & Brand<"SemesterId">;
            total: number;
        },
        checkPrecondition: (
            current: {
                calculated: number;
                confirmation:
                    | {
                        calculated: number;
                        confirmationId: string & Brand<"DaysServedConfirmationId">;
                        confirmedAt: string;
                        confirmedBy: string & Brand<"PersonId">;
                        confirmedByName: string;
                        revision: number;
                        total: number;
                    }
                    | null;
                departmentId: string & Brand<"DepartmentId">;
                evidence: {
                    dates: readonly {
                        schools: readonly {
                            name: string;
                            schoolId: number & Brand<"SchoolId">;
                        }[];
                        serviceDate: string;
                    }[];
                    legacyTotals: readonly {
                        school: { name: string; schoolId: number & Brand<"SchoolId"> };
                        workdays: number;
                    }[];
                };
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                revision: number;
                semesterId: string & Brand<"SemesterId">;
            },
        ) => Effect<void, E, R>,
    ) => Effect<
        {
            calculated: number;
            confirmation: | {
                calculated: number;
                confirmationId: string & Brand<"DaysServedConfirmationId">;
                confirmedAt: string;
                confirmedBy: string & Brand<"PersonId">;
                confirmedByName: string;
                revision: number;
                total: number;
            }
            | null;
            departmentId: string & Brand<"DepartmentId">;
            evidence: {
                dates: readonly {
                    schools: readonly {
                        name: string;
                        schoolId: number & Brand<"SchoolId">;
                    }[];
                    serviceDate: string;
                }[];
                legacyTotals: readonly {
                    school: { name: string; schoolId: number & Brand<"SchoolId"> };
                    workdays: number;
                }[];
            };
            firstName: string;
            lastName: string;
            personId: string & Brand<"PersonId">;
            revision: number;
            semesterId: string & Brand<"SemesterId">;
        },
        DaysServedCommandFailure
        | E,
        R,
    >

    Appends the next confirmation of one assistant's total under the department lock, after the transport precondition on the fresh entry. Never changes an earlier confirmation or a service fact. The callback grants no authority and must not write business state.

    execute: <E, R>(
        input: PlacementExecution,
        checkPrecondition: (current: PlacementSnapshot) => Effect<void, E, R>,
    ) => Effect<PlacementSnapshot, PlacementOperationFailure | E, R>

    Runs on the caller's transaction after current authority and receipt lookup. Holds the department lock across the snapshot precondition, transition, audit, history, and outbox writes. The callback checks a transport-owned precondition; it does not authorize the command or perform business writes. Success returns a snapshot before the caller commits its transaction. Callback failures propagate unchanged; execute does not retry or deliver notifications.

    issueCertificate: <E, R>(
        principal: CertificatePrincipal,
        command: {
            commandId: string;
            departmentId: string & Brand<"DepartmentId">;
            personId: string & Brand<"PersonId">;
        },
        checkPrecondition: (
            current: {
                assistantName: string;
                content:
                    | {
                        assistantName: string;
                        departmentId: string & Brand<"DepartmentId">;
                        departmentName: string;
                        personId: string & Brand<"PersonId">;
                        semesters: readonly {
                            days: number;
                            endsOn: string;
                            schools: readonly string[];
                            semesterId: string & Brand<"SemesterId">;
                            startsOn: string;
                        }[];
                    }
                    | null;
                contentSha256: string
                | null;
                departmentId: string & Brand<"DepartmentId">;
                departmentName: string;
                issuer: {
                    basis: "DerivedSeat" | "BoardSeat" | "GlobalAdministrator";
                    name: string;
                    personId: string & Brand<"PersonId">;
                    seatTitle: string;
                };
                personId: string & Brand<"PersonId">;
                semesters: readonly {
                    calculated: number;
                    endsOn: string;
                    schools: readonly string[];
                    semesterId: string & Brand<"SemesterId">;
                    startsOn: string;
                    status: "Included" | "ConfirmedZero" | "Unconfirmed";
                    total: number | null;
                }[];
            },
        ) => Effect<void, E, R>,
    ) => Effect<
        {
            content: {
                assistantName: string;
                departmentId: string & Brand<"DepartmentId">;
                departmentName: string;
                personId: string & Brand<"PersonId">;
                semesters: readonly {
                    days: number;
                    endsOn: string;
                    schools: readonly string[];
                    semesterId: string & Brand<"SemesterId">;
                    startsOn: string;
                }[];
            };
            contentSha256: string;
            issuedAt: string;
            issuedOn: string;
            issueId: string & Brand<"CertificateIssueId">;
            issuer: {
                basis: "DerivedSeat" | "BoardSeat" | "GlobalAdministrator";
                name: string;
                personId: string & Brand<"PersonId">;
                seatTitle: string;
            };
        },
        CertificateCommandFailure
        | E,
        R,
    >

    Records one issue of the current certificate under the department lock, after the transport precondition on the fresh preview: who, when, the authorizing seat, and the content hash.

    listCertificates: (
        principal: CertificatePrincipal,
        departmentId: string & Brand<"DepartmentId">,
        cursor?: string,
    ) => Effect<CertificateAssistantPage, CertificateReadFailure>

    One bounded page of the assistants with service facts in a department; issuers only.

    listScopes: (
        authority: {
            delegations: readonly {
                area: { departmentId: string & Brand<"DepartmentId"> } | {};
                capability:
                    | "admissions.periods"
                    | "admissions.outcomes"
                    | "recruitment.interviews"
                    | "placements.coordinate"
                    | "placements.days-served"
                    | "schools.administer"
                    | "appointments.manage"
                    | "people.read"
                    | "team-interest.read"
                    | "content.publish"
                    | "receipts.approve"
                    | "receipts.settle"
                    | "delegations.manage"
                    | "organization.govern";
                delegationId: string & Brand<"DelegationId">;
                endAt: string | null;
                holders: "AllMembers" | "LeadersOnly";
                name: string;
                revision: number;
                startAt: string;
                teamId: string & Brand<"TeamId">;
            }[];
            evaluatedAt: string;
            globalAdministrator: "Active"
            | "Inactive"
            | "Absent";
            memberships: readonly {
                active: boolean;
                departmentId: string & Brand<"DepartmentId">;
                departmentIndependent: boolean;
                membershipId: string & Brand<"MembershipId">;
                teamId: string & Brand<"TeamId">;
                teamScope: "National" | "HomeDepartment";
                unitKind: "Team" | "DepartmentBoard";
                unitLeader: boolean;
            }[];
            nationalBoardSeats: readonly {
                active: boolean;
                boardId: string;
                membershipId: string & Brand<"MembershipId">;
                unitLeader: boolean;
            }[];
            personId: string & Brand<"PersonId">;
        },
    ) => Effect<
        {
            departments: readonly {
                canManage: boolean;
                departmentId: string & Brand<"DepartmentId">;
                name: string;
            }[];
            semesters: readonly {
                endAt: string;
                semesterId: string & Brand<"SemesterId">;
                startAt: string;
            }[];
        },
        PlacementOperationFailure,
    >

    Projects management availability from supplied authority; does not authenticate it.

    readBoard: (
        scope: {
            departmentId: string & Brand<"DepartmentId">;
            semesterId: string & Brand<"SemesterId">;
        },
    ) => Effect<
        {
            affiliations: readonly {
                departmentId: string & Brand<"DepartmentId">;
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                revision: number;
                status: "Active" | "Inactive" | "Absent" | "Pending";
            }[];
            commitments: readonly {
                assignments: readonly {
                    block: "1"
                    | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    placementId: string;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                block: "1"
                | "2";
                commitmentId: string;
                createdAt: string;
                createdBy: string & Brand<"PersonId">;
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                decision:
                    | {
                        attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                        decidedAt: string;
                        decidedBy: string & Brand<"PersonId">;
                        evidenceSource: string;
                        occurrenceId: string | null;
                        outcome: "Cancelled" | "Completed" | "Unfulfilled";
                        reason: string | null;
                    }
                    | null;
                departmentId: string & Brand<"DepartmentId">;
                endTime: string;
                overdue: boolean;
                proposalId: string;
                requiredVolunteers: number;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                semesterId: string & Brand<"SemesterId">;
                serviceDate: string;
                startTime: string;
            }[];
            demands: readonly {
                block: "1"
                | "2";
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                requiredVolunteers: number;
                revision: number;
                schoolId: number & Brand<"SchoolId">;
            }[];
            departmentId: string & Brand<"DepartmentId">;
            notifications: readonly {
                attempts: number;
                deliveredAt: string | null;
                effectId: string;
                lastFailureTag: string | null;
                personId: string & Brand<"PersonId">;
                proposalId: string;
                status: "Quarantined" | "Pending" | "Processing" | "Delivered" | "Failed";
            }[];
            occurrences: readonly {
                attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                block: "1" | "2";
                commitmentId: string | null;
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                occurredOn: string;
                occurrenceId: string;
                proposalId: string;
                recordedAt: string;
                recordedBy: string & Brand<"PersonId">;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
            }[];
            placements: readonly {
                active: boolean;
                block: "1"
                | "2"
                | "Both";
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                departmentId: string & Brand<"DepartmentId">;
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                placementId: string;
                revision: number;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                semesterId: string & Brand<"SemesterId">;
                workdays: number;
            }[];
            proposal: | {
                assignments: readonly {
                    block: "1"
                    | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    placementId: string;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                confirmedAt: string
                | null;
                confirmedBy: string & Brand<"PersonId"> | null;
                createdAt: string;
                createdBy: string & Brand<"PersonId">;
                demands: readonly {
                    block: "1" | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    requiredVolunteers: number;
                    revision: number;
                    schoolId: number & Brand<"SchoolId">;
                }[];
                exceptions: readonly {
                    assignedVolunteers: number;
                    block: "1"
                    | "2";
                    code: "DemandUnfilled" | "DemandExceeded" | "AssignmentWithoutDemand";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    exceptionId: string;
                    requiredVolunteers: number;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                proposalId: string;
                reviewedExceptionIds: readonly string[];
                revision: number;
                status: "Draft"
                | "Confirmed";
            }
            | null;
            schools: readonly { name: string; schoolId: number & Brand<"SchoolId"> }[];
            semesterId: string & Brand<"SemesterId">;
        },
        PlacementOperationFailure,
    >

    Reads the scoped board after caller authorization.

    readCertificate: (
        principal: CertificatePrincipal,
        departmentId: string & Brand<"DepartmentId">,
        personId: string & Brand<"PersonId">,
    ) => Effect<
        {
            assistantName: string;
            content: | {
                assistantName: string;
                departmentId: string & Brand<"DepartmentId">;
                departmentName: string;
                personId: string & Brand<"PersonId">;
                semesters: readonly {
                    days: number;
                    endsOn: string;
                    schools: readonly string[];
                    semesterId: string & Brand<"SemesterId">;
                    startsOn: string;
                }[];
            }
            | null;
            contentSha256: string
            | null;
            departmentId: string & Brand<"DepartmentId">;
            departmentName: string;
            issuer: {
                basis: "DerivedSeat" | "BoardSeat" | "GlobalAdministrator";
                name: string;
                personId: string & Brand<"PersonId">;
                seatTitle: string;
            };
            personId: string & Brand<"PersonId">;
            semesters: readonly {
                calculated: number;
                endsOn: string;
                schools: readonly string[];
                semesterId: string & Brand<"SemesterId">;
                startsOn: string;
                status: "Included" | "ConfirmedZero" | "Unconfirmed";
                total: number | null;
            }[];
        },
        CertificateReadFailure,
    >

    The certificate that the principal would issue now, and the semesters it leaves out.

    readCertificateScopes: (
        principal: CertificatePrincipal,
    ) => Effect<
        {
            departments: readonly {
                confirmDaysServed: boolean;
                departmentId: string & Brand<"DepartmentId">;
                issueCertificates: boolean;
                name: string;
            }[];
            semesters: readonly {
                endAt: string;
                semesterId: string & Brand<"SemesterId">;
                startAt: string;
            }[];
        },
        CertificateReadFailure,
    >

    The departments where the principal confirms days served or issues certificates. Either capability in one department grants the read; a principal with neither is denied.

    readCoverageBoard: (
        scope: {
            departmentId: string & Brand<"DepartmentId">;
            semesterId: string & Brand<"SemesterId">;
        },
    ) => Effect<
        {
            absences: readonly {
                absenceId: string;
                block: "1"
                | "2";
                commitmentId: string | null;
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                departmentId: string & Brand<"DepartmentId">;
                personId: string & Brand<"PersonId">;
                proposalId: string;
                reportedAt: string;
                reporterPersonId: string & Brand<"PersonId">;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                semesterId: string & Brand<"SemesterId">;
                serviceDate: string;
            }[];
            closures: readonly {
                absenceId: string;
                closedAt: string;
                closedByPersonId: string & Brand<"PersonId">;
                closureId: string;
                coverageId: string | null;
                coveringPersonId: string & Brand<"PersonId"> | null;
                occurrenceId: string | null;
                outcome: "Covered" | "Uncovered";
                scheduledPersonId: string & Brand<"PersonId">;
            }[];
            commitments: readonly {
                assignments: readonly {
                    block: "1"
                    | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    placementId: string;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                block: "1"
                | "2";
                commitmentId: string;
                createdAt: string;
                createdBy: string & Brand<"PersonId">;
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                decision:
                    | {
                        attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                        decidedAt: string;
                        decidedBy: string & Brand<"PersonId">;
                        evidenceSource: string;
                        occurrenceId: string | null;
                        outcome: "Cancelled" | "Completed" | "Unfulfilled";
                        reason: string | null;
                    }
                    | null;
                departmentId: string & Brand<"DepartmentId">;
                endTime: string;
                overdue: boolean;
                proposalId: string;
                requiredVolunteers: number;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                semesterId: string & Brand<"SemesterId">;
                serviceDate: string;
                startTime: string;
            }[];
            coverage: readonly {
                absenceId: string;
                coverageId: string;
                coveringFirstName: string;
                coveringLastName: string;
                coveringPersonId: string & Brand<"PersonId">;
                recordedAt: string;
                recordedByPersonId: string & Brand<"PersonId">;
            }[];
            coverers: readonly {
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
            }[];
            departmentId: string & Brand<"DepartmentId">;
            occurrences: readonly {
                attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                block: "1" | "2";
                commitmentId: string | null;
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                occurredOn: string;
                occurrenceId: string;
                proposalId: string;
                recordedAt: string;
                recordedBy: string & Brand<"PersonId">;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
            }[];
            rosterAssignments: readonly {
                block: "1"
                | "2";
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                placementId: string;
                proposalId: string;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
            }[];
            semesterId: string & Brand<"SemesterId">;
        },
        PlacementOperationFailure,
    >

    Reads coordinator coverage after caller authorization. Coverage lists current records only.

    readDaysServed: (
        principal: CertificatePrincipal,
        scope: {
            departmentId: string & Brand<"DepartmentId">;
            semesterId: string & Brand<"SemesterId">;
        },
        cursor?: string,
    ) => Effect<DaysServedPage, CertificateReadFailure>

    One bounded page of the assistants of a department and semester: everyone with counted attendance, an accepted legacy total, an active placement, or a confirmation there. Requires placements.days-served in the department.

    readDraft: (
        scope: {
            departmentId: string & Brand<"DepartmentId">;
            semesterId: string & Brand<"SemesterId">;
        },
    ) => Effect<
        {
            departmentId: string & Brand<"DepartmentId">;
            filledPlaces: number;
            openPlaces: number;
            openSlots: readonly {
                block: "1" | "2";
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                places: number;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
            }[];
            placements: readonly {
                block: "1"
                | "2"
                | "Both";
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                wishes: {
                    language: "Norsk" | "Engelsk" | "Norsk og engelsk";
                    preferredSchool: string | null;
                };
                workdays: number;
            }[];
            semesterId: string & Brand<"SemesterId">;
            unplaced: readonly {
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                reason: "NoAvailability" | "NoOpenPlace";
                wishes:
                    | {
                        language: "Norsk"
                        | "Engelsk"
                        | "Norsk og engelsk";
                        preferredSchool: string | null;
                    }
                    | null;
            }[];
        },
        PlacementOperationFailure,
    >

    Drafts placements for the scoped board after caller authorization. The draft reads demand, placements, capacity plans, and current availability, and writes nothing; the same facts give the same draft.

    readOwnAffiliation: (
        personId: string & Brand<"PersonId">,
        departmentId: string & Brand<"DepartmentId">,
    ) => Effect<
        {
            departmentId: string & Brand<"DepartmentId">;
            personId: string & Brand<"PersonId">;
            revision: number;
            status: "Active" | "Inactive" | "Absent" | "Pending";
        },
        PlacementOperationFailure,
    >

    Returns Absent at revision zero when a known department has no affiliation.

    readOwnCoverage: (
        scope: {
            departmentId: string & Brand<"DepartmentId">;
            semesterId: string & Brand<"SemesterId">;
        },
        personId: string & Brand<"PersonId">,
    ) => Effect<
        {
            absences: readonly {
                absenceId: string;
                block: "1"
                | "2";
                commitmentId: string | null;
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                departmentId: string & Brand<"DepartmentId">;
                personId: string & Brand<"PersonId">;
                proposalId: string;
                reportedAt: string;
                reporterPersonId: string & Brand<"PersonId">;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                semesterId: string & Brand<"SemesterId">;
                serviceDate: string;
            }[];
            commitments: readonly {
                assignments: readonly {
                    block: "1"
                    | "2";
                    day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                    firstName: string;
                    lastName: string;
                    personId: string & Brand<"PersonId">;
                    placementId: string;
                    schoolId: number & Brand<"SchoolId">;
                    schoolName: string;
                }[];
                block: "1"
                | "2";
                commitmentId: string;
                createdAt: string;
                createdBy: string & Brand<"PersonId">;
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                decision:
                    | {
                        attendedPersonIds: readonly (string & Brand<"PersonId">)[];
                        decidedAt: string;
                        decidedBy: string & Brand<"PersonId">;
                        evidenceSource: string;
                        occurrenceId: string | null;
                        outcome: "Cancelled" | "Completed" | "Unfulfilled";
                        reason: string | null;
                    }
                    | null;
                departmentId: string & Brand<"DepartmentId">;
                endTime: string;
                overdue: boolean;
                proposalId: string;
                requiredVolunteers: number;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                semesterId: string & Brand<"SemesterId">;
                serviceDate: string;
                startTime: string;
            }[];
            coverage: readonly {
                absenceId: string;
                coverageId: string;
                coveringFirstName: string;
                coveringLastName: string;
                coveringPersonId: string & Brand<"PersonId">;
                recordedAt: string;
                recordedByPersonId: string & Brand<"PersonId">;
            }[];
            coverers: readonly {
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
            }[];
            departmentId: string & Brand<"DepartmentId">;
            personId: string & Brand<"PersonId">;
            placements: readonly {
                active: boolean;
                block: "1" | "2" | "Both";
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                departmentId: string & Brand<"DepartmentId">;
                firstName: string;
                lastName: string;
                personId: string & Brand<"PersonId">;
                placementId: string;
                revision: number;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
                semesterId: string & Brand<"SemesterId">;
                workdays: number;
            }[];
            rosterSlots: readonly {
                block: "1"
                | "2";
                day: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday";
                proposalId: string;
                schoolId: number & Brand<"SchoolId">;
                schoolName: string;
            }[];
            semesterId: string & Brand<"SemesterId">;
        },
        PlacementOperationFailure,
    >

    Reads one person's coverage after caller authorization. Current placements include only active rows for that person, department, and semester. Placements, confirmed roster slots, and dated commitments remain separate facts. Commitments are those where the person is scheduled or covers a recorded absence. Coverers are listed only while the person has an absence in an open commitment.