import type { FdoDecimal } from '@feedmepos/core/entity'; import type { WithRev } from '@/api/type'; export interface CreateProductionRunInput { /** * Client-minted timestamp-shaped run id for this create INTENT — not this attempt. Every * retry of the same intent (for example, a timeout before the operator has * seen a result) must resend the same key so the server can * recognise it as the same create rather than a second run; a genuinely new * or reset draft mints a new one. See `useProductionRunApi`'s create caller. */ operationKey: string; items: FdoProductionRunItem[]; /** * Optional label expressed explicitly: null means the operator left it * blank. `runNo` remains the durable display fallback. */ runName: string | null; /** * The requester's handoff note for the whole run. Distinct from `remark`, * which describes this write and lands on an activity-log entry. */ instructions: string | null; } export interface UpdateProductionRunInput { _rev: string; items: FdoProductionRunItem[]; /** Pass `null` to clear the name. Updates replace the complete draft form. */ runName: string | null; /** Same contract as `runName`, and editable only while the run is a DRAFT. */ instructions: string | null; } export interface PrepareProductionRunInput { committed: { skuId: string; amount: FdoDecimal; measurement: FdoProductionUnitSnapshot; }[]; acknowledgeShortages: boolean; remark: string | null; } export interface RecordProductionOutputInput { /** Client-minted identity for this ordinary write attempt. */ operationKey: string; /** The actual production datetime, entered by the user. */ producedAt: string; items: FdoProductionRunBatchItem[]; wastages: RecordProductionOutputWastageInput[]; /** Product-optional batch note. Blank input is explicit null; never omitted. */ remark: string | null; } /** The generated durable wastage line used by the Record Output request. */ export type RecordProductionOutputWastageInput = FdoProductionWastageLine; /** The persisted run shape returned by every Production Run API operation. */ export type ProductionRunDocument = WithRev; export interface ProductionRunListOptions { status?: F_PRODUCTION_RUN_STATUS; limit?: number; cursor?: string; } export interface ProductionRunPage { items: ProductionRunDocument[]; nextCursor: string | null; } export interface ProductionRunPlanningContext { ruleContext: Record; } export type PrepareProductionRunResult = ProductionRunDocument; export type RecordProductionOutputResult = ProductionRunDocument; export declare const useProductionRunApi: () => { list(options?: ProductionRunListOptions): Promise; planningContext(): Promise; read(id: string): Promise; create(dto: CreateProductionRunInput): Promise; update(id: string, dto: UpdateProductionRunInput): Promise; request(id: string, remark?: string | null): Promise; prepare(id: string, dto: PrepareProductionRunInput): Promise; complete(id: string, dto: RecordProductionOutputInput): Promise; close(id: string, remark?: string | null): Promise; cancel(id: string, reason?: string | null): Promise; };