import { type Ref } from 'vue'; import { ProductionRunOperations } from '@feedmepos/inventory-core-dart/production-run'; import type { WithRev } from '@/api/type'; import { type ProductionRunFailure } from '@/api/production-run-error'; import { type ProductionRunCommitRow } from './production-run-frozen-ingredients'; import { productionRunDisplayName } from '../../shared/model/production-run-list'; import { type ProductionRunPlanProblem } from '../../shared/model/production-run-plan-problem'; import { type ProductionRunQuantityModel, type ProductionRunUnitSnapshot } from '../../shared/model/production-run-unit-snapshot'; export type { ProductionRunCommitContributor, ProductionRunCommitRow } from './production-run-frozen-ingredients'; export interface ProductionRunPlannerItem { /** The controller key, which is the sku id. */ key: string; skuId: string; name: string; code: string; /** Base unit abbreviation — what on-hand and the ingredient tree are stated in. */ baseUnit: string; /** The unit the quantity is currently entered in. */ enteredUnit: string; onHand: number | null; /** The requested quantity converted to the sku's base unit. */ baseQuantity: number; sku: FdoInventorySku; model: ProductionRunQuantityModel; bindingCount: number; bindingLines: { id: string; name: string; amount: number; unit: string; }[]; } export interface ProductionRunHistoricalItem { key: string; skuId: string; name: string; code: string; enteredUnit: string; onHand: null; /** Null when the stored snapshot no longer belongs to the live base-unit family. */ baseUnit: string | null; baseQuantity: number | null; model: ProductionRunQuantityModel; bindingCount: 0; bindingLines: []; } /** * Outputs that will draw no ingredients: a valid positive authored quantity, * and nothing bound. * * Both halves are load-bearing. Deriving this from "contributes to no commit * row" instead — which is what the planner and the Prepare dialog each did * independently — conflates it with a quantity of zero, since a zero-quantity * item produces no rows either. That made "No quantities set" unreachable * through the planner: any selected item, unquantified, was reported as * committing nothing. * * This classification deliberately reads the raw authored amount rather than * `baseQuantity`. Base conversion is zero when a unit snapshot is missing or * stale, but that is a separate validation failure: it must not hide the fact * that a positively quantified output has no ingredient bindings. Submission * remains gated on a valid matching snapshot below. */ export declare function unboundOutputNames(items: ProductionRunPlannerItem[]): string[]; export interface ProductionRunShortage { name: string; /** How far below zero the projected balance lands. */ over: number; unit: string; } /** * One sku the seeded document listed more than once, and the single line those * lines were combined into. * * A fact about the seed, frozen at `seedFrom`: it says what the DOCUMENT held, * so later edits to the combined line must not rewrite it. Quantities are * resolved to plain numbers here, each beside the unit it was stored in — the * point of showing them is that they read back the way the run was written. */ export interface ProductionRunDuplicateMerge { skuId: string; name: string; /** The stored lines, in document order, each in the unit it was saved with. */ sources: { amount: number; unit: string; }[]; /** What they add up to, or null when the sources name different base-unit families. */ amount: number | null; unit: string | null; } export interface ProductionRunSaveAndRequestResult { run: WithRev; /** False when the draft was saved but `request` failed — the save persists. */ requested: boolean; failure: ProductionRunFailure | null; } export declare function useProductionRunForm(): { loading: Ref; refreshingStock: Ref; loadFailure: Ref<{ kind: import("@/api/production-run-error").ProductionRunFailureKind; message: string; retrySameKey: boolean; mustReload: boolean; shortages: { skuId: string; baseUnit: { name: string; id: string; abbrev: string; conversion: { amount: number; precision: number; }; baseUnitId: string; }; projectedBalance: { amount: number; precision: number; }; }[]; skuIds: string[]; checkpoint?: { before: string; reason: "overTarget" | "recovery"; } | undefined; } | null, ProductionRunFailure | { kind: import("@/api/production-run-error").ProductionRunFailureKind; message: string; retrySameKey: boolean; mustReload: boolean; shortages: { skuId: string; baseUnit: { name: string; id: string; abbrev: string; conversion: { amount: number; precision: number; }; baseUnitId: string; }; projectedBalance: { amount: number; precision: number; }; }[]; skuIds: string[]; checkpoint?: { before: string; reason: "overTarget" | "recovery"; } | undefined; } | null>; submitting: Ref; dirty: Ref; runName: Ref; instructions: Ref; createOperationKey: Ref; items: import("vue").ComputedRef; commits: import("vue").ComputedRef; requestedIngredientRows: (run: FdoProductionRun) => ProductionRunCommitRow[]; proposedIngredientRows: (run: FdoProductionRun, committed: Parameters[0]['committed']) => ProductionRunCommitRow[]; shortages: import("vue").ComputedRef; candidates: import("vue").ComputedRef<{ sku: { trackingMeasurement?: string | null | undefined; isInactive?: boolean | null | undefined; convert?: { measurement?: string | null | undefined; inventoryBindings?: { measurement?: { name: string; id: string; abbrev: string; conversion: { amount: number; precision: number; }; } | null | undefined; rules?: Record | null | undefined; alternatives?: { default?: boolean | null | undefined; trackingMeasurement?: string | null | undefined; priority?: number | null | undefined; _id: string; }[] | null | undefined; type: "RECIPE" | "SKU" | "SKU_GROUP"; amount: { amount: number; precision: number; }; id: string; }[] | null | undefined; } | null | undefined; valuation?: "FIFO" | "LIFO" | "FEFO" | "WAVG" | null | undefined; defaultCost?: { measurement?: { name: string; id: string; abbrev: string; conversion: { amount: number; precision: number; }; } | null | undefined; costPerUnit: { currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHE" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XAG" | "XAU" | "XBA" | "XBB" | "XBC" | "XBD" | "XCD" | "XDR" | "XOF" | "XPD" | "XPF" | "XPT" | "XSU" | "XTS" | "XUA" | "XXX" | "YER" | "ZAR" | "ZMW" | "ZWL"; amount: number; precision: number; }; } | null | undefined; operationalGroup?: string | null | undefined; thresholds?: { low: number; mid: number; } | null | undefined; customAttributes?: Record | null | undefined; unit: { _id: string; name: string; abbrev: string; precision: number; measurements: { name: string; id: string; abbrev: string; conversion: { amount: number; precision: number; }; }[]; }; code: string; _id: string; name: string; }; hasBindings: boolean; onHand: number; }[]>; projectionFailed: Ref; projectionProblem: Ref<{ reason: import("../../shared/model/production-run-plan-problem").ProductionRunPlanProblemReason; subject: string; } | null, ProductionRunPlanProblem | { reason: import("../../shared/model/production-run-plan-problem").ProductionRunPlanProblemReason; subject: string; } | null>; catalogueName: (id: string) => string | undefined; duplicateMerges: Ref<{ skuId: string; name: string; sources: { amount: number; unit: string; }[]; amount: number | null; unit: string | null; }[], ProductionRunDuplicateMerge[] | { skuId: string; name: string; sources: { amount: number; unit: string; }[]; amount: number | null; unit: string | null; }[]>; canSubmit: import("vue").ComputedRef; canRequest: import("vue").ComputedRef; load: (options?: { livePlan?: boolean; }) => Promise; loadCatalogue: () => Promise; historicalItems: (run: FdoProductionRun) => ProductionRunHistoricalItem[]; refreshStock: () => Promise; retryProjection: () => void; reset: () => void; discard: () => void; seedFrom: (run: FdoProductionRun) => void; addItems: (skuIds: string[]) => void; removeItem: (key: string) => void; clearAll: () => void; duplicateItems: (source: FdoProductionRun, skuIds: string[], mode: 'add' | 'replace', measurementOverrides?: Record) => void; updateItemModel: (key: string, model: ProductionRunQuantityModel) => void; updateRunName: (value: string) => void; updateInstructions: (value: string) => void; createDraft: () => Promise>; updateDraft: (id: string) => Promise>; createAndRequest: () => Promise; updateAndRequest: (id: string) => Promise; displayName: typeof productionRunDisplayName; };