/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type ValueTypeOf } from "@elaraai/east"; import { RosterFitRequestType, RosterFitResultType, RosterNeedType } from "@elaraai/e3-ui/internal"; import type { OptimiseSessions } from "../shared/func/use-optimise.js"; import type { SourcesChrome } from "../shared/schedule/visibility.js"; import { type Context, type RosterValue, type Slot, type Week } from "./model.js"; /** What a Find fix looks for: a lead, a trainer, or a holder of a skill. */ export type Need = ValueTypeOf; /** The fit's answer: a verdict for each person the function considered, by staff key. */ export type FitResult = ValueTypeOf; /** The fit's request: the question and the page's scope. */ export type FitRequest = ValueTypeOf; /** A find: a need on an issue's slot — the question the fit is asked. */ export interface RosterFind { need: Need; slot: Slot; } /** Whether two finds ask the same question. */ export declare const sameFind: (a: RosterFind, b: RosterFind) => boolean; /** The Roster's fit, for its one find. */ export interface RosterFit { /** Whether the app bound a fit: a Find fix is offered only then (R2). */ offered: boolean; /** The find's answer for the drafts as they are, which the People tab shows; none while it is on its way (F2) or failed. */ shown: FitResult | undefined; /** Whether the find is asked and its answer for the drafts as they are has not landed (R4: its fix reads `Finding…`). */ pending: boolean; /** Why the fit's last call failed (R4: a warning banner with Retry). */ error: string | undefined; /** Asks the failed question again. */ retry: () => void; } /** What an ask takes beside its question: the page's rail, its sessions and their drafts. */ export interface RosterFitAsked { /** The Roster's rail, as its payload carries it: the page's scope is each source's of it. */ readonly chrome: SourcesChrome | undefined; /** The Roster's sessions over the records it edits — the duties', the periods' and the targets': what an ask takes its drafts from. */ readonly sessions: OptimiseSessions; /** The sessions' drafts, the same object while their bytes hold: an answer is kept for the drafts it was asked of. */ readonly drafts: object; } /** * The Roster's fit (see the module docs). * * @param value - The payload: the fit's binding, `none` without one, and the duty kind's row type * @param start - The week's first day * @param week - The drafted week, as the page reads it * @param context - The complete staff and configuration, as the page reads them * @param asked - The page's rail, its sessions and their drafts * @param find - The find the People tab shows, if any * @returns The fit, for that find */ export declare function useRosterFit(value: RosterValue, start: Date, week: Week, context: Context, asked: RosterFitAsked, find: RosterFind | undefined): RosterFit; //# sourceMappingURL=fit.d.ts.map