// @generated — do not edit
import { defineLifecycle } from "@tailor-platform/erp-kit/core";

export const salesOrderLifecycle = defineLifecycle({
    submit: { from: ["DRAFT"], to: "SUBMITTED" },
    reject: { from: ["SUBMITTED"], to: "DRAFT" },
    confirm: { from: ["SUBMITTED"], to: "CONFIRMED" },
    placeCreditHold: { from: ["CONFIRMED", "PARTIALLY_SHIPPED", "PARTIALLY_INVOICED", "SHIPPED", "INVOICED"], to: "CREDIT_HOLD" },
    releaseCreditHold: { from: ["CREDIT_HOLD"], to: "CONFIRMED" },
    partialShip: { from: ["CONFIRMED"], to: "PARTIALLY_SHIPPED" },
    completeShip: { from: ["PARTIALLY_SHIPPED"], to: "SHIPPED" },
    partialInvoice: { from: ["CONFIRMED", "PARTIALLY_SHIPPED", "SHIPPED"], to: "PARTIALLY_INVOICED" },
    completeInvoice: { from: ["PARTIALLY_INVOICED"], to: "INVOICED" },
    cancel: { from: ["CONFIRMED", "CREDIT_HOLD", "DRAFT", "SUBMITTED"], to: "CANCELLED" },
    close: { from: ["CONFIRMED", "PARTIALLY_SHIPPED", "SHIPPED", "PARTIALLY_INVOICED", "INVOICED"], to: "CLOSED" },
});

export type SalesOrderStatus = typeof salesOrderLifecycle.states[number];
