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

export const BudgetNotFoundError = createDomainError(
  "BudgetNotFoundError", "ACCOUNTING_BUDGET_NOT_FOUND",
  (identifier: string) => `Budget with the specified ID does not exist: ${identifier}`,
);

export const InvalidStateError = createDomainError(
  "InvalidStateError", "ACCOUNTING_INVALID_STATE",
  (identifier: string) => `Budget is not in APPROVED status: ${identifier}`,
);

export const DuplicateActiveBudgetError = createDomainError(
  "DuplicateActiveBudgetError", "ACCOUNTING_DUPLICATE_ACTIVE_BUDGET",
  (identifier: string) => `Another ACTIVE budget of type BUDGET already exists for the same cost object and fiscal year: ${identifier}`,
);

export const CostElementNotFoundError = createDomainError(
  "CostElementNotFoundError", "ACCOUNTING_COST_ELEMENT_NOT_FOUND",
  (identifier: string) => `Cost element with the specified ID does not exist: ${identifier}`,
);

export const ProfitCenterNotFoundError = createDomainError(
  "ProfitCenterNotFoundError", "ACCOUNTING_PROFIT_CENTER_NOT_FOUND",
  (identifier: string) => `Profit center with the specified ID does not exist: ${identifier}`,
);

export const SelfApprovalNotAllowedError = createDomainError(
  "SelfApprovalNotAllowedError", "ACCOUNTING_SELF_APPROVAL_NOT_ALLOWED",
  (identifier: string) => `Approver is the same user who created the budget (segregation of duties violation): ${identifier}`,
);

export const CostCenterNotFoundError = createDomainError(
  "CostCenterNotFoundError", "ACCOUNTING_COST_CENTER_NOT_FOUND",
  (identifier: string) => `Cost center with the specified ID does not exist: ${identifier}`,
);

export const HierarchyNodeNotFoundError = createDomainError(
  "HierarchyNodeNotFoundError", "ACCOUNTING_HIERARCHY_NODE_NOT_FOUND",
  (identifier: string) => `Target hierarchy node does not exist: ${identifier}`,
);

export const CompanyMismatchError = createDomainError(
  "CompanyMismatchError", "ACCOUNTING_COMPANY_MISMATCH",
  (identifier: string) => `Cost center and target hierarchy node do not belong to the same company: ${identifier}`,
);

export const InternalOrderNotFoundError = createDomainError(
  "InternalOrderNotFoundError", "ACCOUNTING_INTERNAL_ORDER_NOT_FOUND",
  (identifier: string) => `Internal order with the specified ID does not exist: ${identifier}`,
);

export const CommitmentNotFoundError = createDomainError(
  "CommitmentNotFoundError", "ACCOUNTING_COMMITMENT_NOT_FOUND",
  (identifier: string) => `No commitment exists for the specified cost element, cost object, and period: ${identifier}`,
);

export const InvalidConsumptionAmountError = createDomainError(
  "InvalidConsumptionAmountError", "ACCOUNTING_INVALID_CONSUMPTION_AMOUNT",
  (identifier: string) => `Consumption amount is not positive: ${identifier}`,
);

export const ConsumptionExceedsCommitmentError = createDomainError(
  "ConsumptionExceedsCommitmentError", "ACCOUNTING_CONSUMPTION_EXCEEDS_COMMITMENT",
  (identifier: string) => `Consumption amount exceeds the remaining commitment amount: ${identifier}`,
);

export const CompanyNotFoundError = createDomainError(
  "CompanyNotFoundError", "ACCOUNTING_COMPANY_NOT_FOUND",
  (identifier: string) => `Referenced company does not exist or is not in ACTIVE status: ${identifier}`,
);

export const InvalidAllocationTypeError = createDomainError(
  "InvalidAllocationTypeError", "ACCOUNTING_INVALID_ALLOCATION_TYPE",
  (identifier: string) => `Type is not ASSESSMENT or DISTRIBUTION: ${identifier}`,
);

export const AccountingPeriodNotFoundError = createDomainError(
  "AccountingPeriodNotFoundError", "ACCOUNTING_ACCOUNTING_PERIOD_NOT_FOUND",
  (identifier: string) => `Referenced accounting period does not exist: ${identifier}`,
);

export const InvalidNameError = createDomainError(
  "InvalidNameError", "ACCOUNTING_INVALID_NAME",
  (identifier: string) => `Name is missing or empty: ${identifier}`,
);

export const AllocationCycleNotFoundError = createDomainError(
  "AllocationCycleNotFoundError", "ACCOUNTING_ALLOCATION_CYCLE_NOT_FOUND",
  (identifier: string) => `Allocation cycle with the specified ID does not exist: ${identifier}`,
);

export const SenderNotFoundError = createDomainError(
  "SenderNotFoundError", "ACCOUNTING_SENDER_NOT_FOUND",
  (identifier: string) => `Referenced sender cost center does not exist: ${identifier}`,
);

export const ReceiverNotFoundError = createDomainError(
  "ReceiverNotFoundError", "ACCOUNTING_RECEIVER_NOT_FOUND",
  (identifier: string) => `One or more referenced receiver cost objects do not exist: ${identifier}`,
);

export const SenderIsReceiverError = createDomainError(
  "SenderIsReceiverError", "ACCOUNTING_SENDER_IS_RECEIVER",
  (identifier: string) => `Sender cost center appears as a receiver in the same rule: ${identifier}`,
);

export const InvalidPercentageError = createDomainError(
  "InvalidPercentageError", "ACCOUNTING_INVALID_PERCENTAGE",
  (identifier: string) => `One or more percentage values are not positive: ${identifier}`,
);

export const FiscalYearNotFoundError = createDomainError(
  "FiscalYearNotFoundError", "ACCOUNTING_FISCAL_YEAR_NOT_FOUND",
  (identifier: string) => `Referenced fiscal year does not exist: ${identifier}`,
);

export const CostObjectNotFoundError = createDomainError(
  "CostObjectNotFoundError", "ACCOUNTING_COST_OBJECT_NOT_FOUND",
  (identifier: string) => `Referenced cost object (cost center, profit center, or internal order) does not exist: ${identifier}`,
);

export const PlanVersionNotFoundError = createDomainError(
  "PlanVersionNotFoundError", "ACCOUNTING_PLAN_VERSION_NOT_FOUND",
  (identifier: string) => `Referenced plan version does not exist: ${identifier}`,
);

export const BudgetHolderRequiredError = createDomainError(
  "BudgetHolderRequiredError", "ACCOUNTING_BUDGET_HOLDER_REQUIRED",
  (identifier: string) => `Budget holder reference is missing: ${identifier}`,
);

export const InvalidCostElementError = createDomainError(
  "InvalidCostElementError", "ACCOUNTING_INVALID_COST_ELEMENT",
  (identifier: string) => `Referenced cost element does not exist, is not PRIMARY type, or is not in ACTIVE status: ${identifier}`,
);

export const InvalidPlannedAmountError = createDomainError(
  "InvalidPlannedAmountError", "ACCOUNTING_INVALID_PLANNED_AMOUNT",
  (identifier: string) => `Planned amount is not a positive value: ${identifier}`,
);

export const DuplicateLineItemError = createDomainError(
  "DuplicateLineItemError", "ACCOUNTING_DUPLICATE_LINE_ITEM",
  (identifier: string) => `A line item with the same cost element and period already exists in this budget: ${identifier}`,
);

export const DuplicateCostCenterCodeError = createDomainError(
  "DuplicateCostCenterCodeError", "ACCOUNTING_DUPLICATE_COST_CENTER_CODE",
  (identifier: string) => `A cost center with the same code already exists within the company: ${identifier}`,
);

export const InvalidCategoryError = createDomainError(
  "InvalidCategoryError", "ACCOUNTING_INVALID_CATEGORY",
  (identifier: string) => `Category is not one of the recognized values (overhead, production, administration, sales, research): ${identifier}`,
);

export const InvalidValidityPeriodError = createDomainError(
  "InvalidValidityPeriodError", "ACCOUNTING_INVALID_VALIDITY_PERIOD",
  (identifier: string) => `validTo is before validFrom: ${identifier}`,
);

export const HierarchyNotFoundError = createDomainError(
  "HierarchyNotFoundError", "ACCOUNTING_HIERARCHY_NOT_FOUND",
  (identifier: string) => `Referenced hierarchy does not exist: ${identifier}`,
);

export const ParentNodeNotFoundError = createDomainError(
  "ParentNodeNotFoundError", "ACCOUNTING_PARENT_NODE_NOT_FOUND",
  (identifier: string) => `Referenced parent node does not exist within the hierarchy: ${identifier}`,
);

export const DuplicateRootNodeError = createDomainError(
  "DuplicateRootNodeError", "ACCOUNTING_DUPLICATE_ROOT_NODE",
  (identifier: string) => `A root node already exists in this hierarchy: ${identifier}`,
);

export const SelfReferenceError = createDomainError(
  "SelfReferenceError", "ACCOUNTING_SELF_REFERENCE",
  (identifier: string) => `Node cannot reference itself as its parent: ${identifier}`,
);

export const CircularReferenceError = createDomainError(
  "CircularReferenceError", "ACCOUNTING_CIRCULAR_REFERENCE",
  (identifier: string) => `Creating this node would introduce a circular reference in the hierarchy: ${identifier}`,
);

export const DuplicateCostElementCodeError = createDomainError(
  "DuplicateCostElementCodeError", "ACCOUNTING_DUPLICATE_COST_ELEMENT_CODE",
  (identifier: string) => `A cost element with the same code already exists within the company: ${identifier}`,
);

export const InvalidCostElementTypeError = createDomainError(
  "InvalidCostElementTypeError", "ACCOUNTING_INVALID_COST_ELEMENT_TYPE",
  (identifier: string) => `Type is not PRIMARY or SECONDARY: ${identifier}`,
);

export const InvalidCategoryForTypeError = createDomainError(
  "InvalidCategoryForTypeError", "ACCOUNTING_INVALID_CATEGORY_FOR_TYPE",
  (identifier: string) => `Category does not match the cost element type (e.g., assessment category on a PRIMARY element): ${identifier}`,
);

export const GlAccountRequiredError = createDomainError(
  "GlAccountRequiredError", "ACCOUNTING_GL_ACCOUNT_REQUIRED",
  (identifier: string) => `PRIMARY cost element is missing the required glAccountId: ${identifier}`,
);

export const GlAccountNotFoundError = createDomainError(
  "GlAccountNotFoundError", "ACCOUNTING_GL_ACCOUNT_NOT_FOUND",
  (identifier: string) => `Referenced GL account does not exist or is not active within an active Chart of Accounts: ${identifier}`,
);

export const GlAccountNotAllowedError = createDomainError(
  "GlAccountNotAllowedError", "ACCOUNTING_GL_ACCOUNT_NOT_ALLOWED",
  (identifier: string) => `SECONDARY cost element must not reference a GL account: ${identifier}`,
);

export const DuplicateGlAccountReferenceError = createDomainError(
  "DuplicateGlAccountReferenceError", "ACCOUNTING_DUPLICATE_GL_ACCOUNT_REFERENCE",
  (identifier: string) => `Another PRIMARY cost element within the same company already references the specified GL account: ${identifier}`,
);

export const DuplicateOrderNumberError = createDomainError(
  "DuplicateOrderNumberError", "ACCOUNTING_DUPLICATE_ORDER_NUMBER",
  (identifier: string) => `An internal order with the same order number already exists within the company: ${identifier}`,
);

export const InvalidOrderTypeError = createDomainError(
  "InvalidOrderTypeError", "ACCOUNTING_INVALID_ORDER_TYPE",
  (identifier: string) => `Order type is not one of the recognized values (OVERHEAD, INVESTMENT, ACCRUAL): ${identifier}`,
);

export const DescriptionRequiredError = createDomainError(
  "DescriptionRequiredError", "ACCOUNTING_DESCRIPTION_REQUIRED",
  (identifier: string) => `Description is missing or empty: ${identifier}`,
);

export const ResponsiblePersonRequiredError = createDomainError(
  "ResponsiblePersonRequiredError", "ACCOUNTING_RESPONSIBLE_PERSON_REQUIRED",
  (identifier: string) => `Responsible person reference is missing: ${identifier}`,
);

export const InvalidVersionTypeError = createDomainError(
  "InvalidVersionTypeError", "ACCOUNTING_INVALID_VERSION_TYPE",
  (identifier: string) => `Type is not BUDGET, FORECAST, or SIMULATION: ${identifier}`,
);

export const BaseVersionNotFoundError = createDomainError(
  "BaseVersionNotFoundError", "ACCOUNTING_BASE_VERSION_NOT_FOUND",
  (identifier: string) => `Referenced base version does not exist: ${identifier}`,
);

export const DuplicateProfitCenterCodeError = createDomainError(
  "DuplicateProfitCenterCodeError", "ACCOUNTING_DUPLICATE_PROFIT_CENTER_CODE",
  (identifier: string) => `A profit center with the same code already exists within the company: ${identifier}`,
);

export const ValidFromRequiredError = createDomainError(
  "ValidFromRequiredError", "ACCOUNTING_VALID_FROM_REQUIRED",
  (identifier: string) => `validFrom date is required but not provided: ${identifier}`,
);

export const AllocationRuleNotFoundError = createDomainError(
  "AllocationRuleNotFoundError", "ACCOUNTING_ALLOCATION_RULE_NOT_FOUND",
  (identifier: string) => `Allocation rule with the specified ID does not exist: ${identifier}`,
);

export const BudgetLineItemNotFoundError = createDomainError(
  "BudgetLineItemNotFoundError", "ACCOUNTING_BUDGET_LINE_ITEM_NOT_FOUND",
  (identifier: string) => `Budget line item with the specified ID does not exist: ${identifier}`,
);

export const CostCenterHasPostingsError = createDomainError(
  "CostCenterHasPostingsError", "ACCOUNTING_COST_CENTER_HAS_POSTINGS",
  (identifier: string) => `Cost center has associated cost postings and cannot be deleted: ${identifier}`,
);

export const CostCenterHasBudgetItemsError = createDomainError(
  "CostCenterHasBudgetItemsError", "ACCOUNTING_COST_CENTER_HAS_BUDGET_ITEMS",
  (identifier: string) => `Cost center has associated budget line items and cannot be deleted: ${identifier}`,
);

export const CostCenterHasAllocationRulesError = createDomainError(
  "CostCenterHasAllocationRulesError", "ACCOUNTING_COST_CENTER_HAS_ALLOCATION_RULES",
  (identifier: string) => `Cost center is referenced by allocation rules and cannot be deleted: ${identifier}`,
);

export const NodeNotFoundError = createDomainError(
  "NodeNotFoundError", "ACCOUNTING_NODE_NOT_FOUND",
  (identifier: string) => `Hierarchy node with the specified ID does not exist: ${identifier}`,
);

export const NodeHasChildrenError = createDomainError(
  "NodeHasChildrenError", "ACCOUNTING_NODE_HAS_CHILDREN",
  (identifier: string) => `Node has child nodes that must be reassigned or removed first: ${identifier}`,
);

export const NodeHasAssignedCostCentersError = createDomainError(
  "NodeHasAssignedCostCentersError", "ACCOUNTING_NODE_HAS_ASSIGNED_COST_CENTERS",
  (identifier: string) => `Node has cost centers assigned that must be reassigned first: ${identifier}`,
);

export const NodeHasAssignedProfitCentersError = createDomainError(
  "NodeHasAssignedProfitCentersError", "ACCOUNTING_NODE_HAS_ASSIGNED_PROFIT_CENTERS",
  (identifier: string) => `Node has profit centers assigned that must be reassigned first: ${identifier}`,
);

export const VarianceReportNotFoundError = createDomainError(
  "VarianceReportNotFoundError", "ACCOUNTING_VARIANCE_REPORT_NOT_FOUND",
  (identifier: string) => `Variance report with the specified ID does not exist: ${identifier}`,
);

export const NoBudgetDataError = createDomainError(
  "NoBudgetDataError", "ACCOUNTING_NO_BUDGET_DATA",
  (identifier: string) => `No budget line items exist for the specified cost object and period: ${identifier}`,
);

export const PeriodNotOpenError = createDomainError(
  "PeriodNotOpenError", "ACCOUNTING_PERIOD_NOT_OPEN",
  (identifier: string) => `Accounting period is not in OPEN or FUTURE_ENTERABLE status (e.g., CLOSED or PERMANENTLY_CLOSED): ${identifier}`,
);

export const InvalidCommitmentAmountError = createDomainError(
  "InvalidCommitmentAmountError", "ACCOUNTING_INVALID_COMMITMENT_AMOUNT",
  (identifier: string) => `Commitment amount is not positive: ${identifier}`,
);

export const NoActiveBudgetError = createDomainError(
  "NoActiveBudgetError", "ACCOUNTING_NO_ACTIVE_BUDGET",
  (identifier: string) => `No active budget exists for the specified cost object: ${identifier}`,
);

export const ReasonRequiredError = createDomainError(
  "ReasonRequiredError", "ACCOUNTING_REASON_REQUIRED",
  (identifier: string) => `Rejection reason text is missing or empty: ${identifier}`,
);

export const NoCommitmentToReleaseError = createDomainError(
  "NoCommitmentToReleaseError", "ACCOUNTING_NO_COMMITMENT_TO_RELEASE",
  (identifier: string) => `Commitment has already been fully consumed or released (remaining amount is zero): ${identifier}`,
);

export const NoLineItemsError = createDomainError(
  "NoLineItemsError", "ACCOUNTING_NO_LINE_ITEMS",
  (identifier: string) => `Budget has no line items and cannot be submitted: ${identifier}`,
);

export const CodeChangeNotAllowedError = createDomainError(
  "CodeChangeNotAllowedError", "ACCOUNTING_CODE_CHANGE_NOT_ALLOWED",
  (identifier: string) => `Cost center code cannot be changed after creation: ${identifier}`,
);

export const TypeChangeNotAllowedError = createDomainError(
  "TypeChangeNotAllowedError", "ACCOUNTING_TYPE_CHANGE_NOT_ALLOWED",
  (identifier: string) => `Changing the type (PRIMARY/SECONDARY) is never permitted: ${identifier}`,
);

export const CategoryChangeNotAllowedError = createDomainError(
  "CategoryChangeNotAllowedError", "ACCOUNTING_CATEGORY_CHANGE_NOT_ALLOWED",
  (identifier: string) => `Category cannot be changed when the cost element is in ACTIVE status: ${identifier}`,
);

export const GlAccountChangeNotAllowedError = createDomainError(
  "GlAccountChangeNotAllowedError", "ACCOUNTING_GL_ACCOUNT_CHANGE_NOT_ALLOWED",
  (identifier: string) => `GL account reference cannot be changed after activation: ${identifier}`,
);

export const OrderTypeChangeNotAllowedError = createDomainError(
  "OrderTypeChangeNotAllowedError", "ACCOUNTING_ORDER_TYPE_CHANGE_NOT_ALLOWED",
  (identifier: string) => `Order type cannot be changed after the order is released: ${identifier}`,
);

export const FieldNotUpdatableError = createDomainError(
  "FieldNotUpdatableError", "ACCOUNTING_FIELD_NOT_UPDATABLE",
  (identifier: string) => `Attempted to change a field that is not updatable in ACTIVE status: ${identifier}`,
);

export const NoAllocationRulesError = createDomainError(
  "NoAllocationRulesError", "ACCOUNTING_NO_ALLOCATION_RULES",
  (identifier: string) => `Cycle has no allocation rules defined: ${identifier}`,
);

export const InvalidPercentageSumError = createDomainError(
  "InvalidPercentageSumError", "ACCOUNTING_INVALID_PERCENTAGE_SUM",
  (identifier: string) => `Allocation rule percentages for one or more senders do not sum to exactly 100%: ${identifier}`,
);

export const NoBudgetDefinedError = createDomainError(
  "NoBudgetDefinedError", "ACCOUNTING_NO_BUDGET_DEFINED",
  (identifier: string) => `No ACTIVE budget exists for the specified cost object and fiscal year — caller receives null availability: ${identifier}`,
);

export const NoBudgetLineItemError = createDomainError(
  "NoBudgetLineItemError", "ACCOUNTING_NO_BUDGET_LINE_ITEM",
  (identifier: string) => `ACTIVE budget exists but no line item matches the specified cost element and period — caller receives null availability: ${identifier}`,
);

export const CostCenterHierarchyNotFoundError = createDomainError(
  "CostCenterHierarchyNotFoundError", "ACCOUNTING_COST_CENTER_HIERARCHY_NOT_FOUND",
  (identifier: string) => `No cost center hierarchy matches the given id — caller receives null: ${identifier}`,
);

export const ProfitCenterHierarchyNotFoundError = createDomainError(
  "ProfitCenterHierarchyNotFoundError", "ACCOUNTING_PROFIT_CENTER_HIERARCHY_NOT_FOUND",
  (identifier: string) => `No profit center hierarchy matches the given id — caller receives null: ${identifier}`,
);

export const InvalidTypeFilterError = createDomainError(
  "InvalidTypeFilterError", "ACCOUNTING_INVALID_TYPE_FILTER",
  (identifier: string) => `Provided type value is not ASSESSMENT or DISTRIBUTION: ${identifier}`,
);

export const InvalidStatusFilterError = createDomainError(
  "InvalidStatusFilterError", "ACCOUNTING_INVALID_STATUS_FILTER",
  (identifier: string) => `Provided status value is not DRAFT, VALIDATED, EXECUTED, POSTED, or REVERSED: ${identifier}`,
);

export const InvalidCostObjectTypeFilterError = createDomainError(
  "InvalidCostObjectTypeFilterError", "ACCOUNTING_INVALID_COST_OBJECT_TYPE_FILTER",
  (identifier: string) => `Provided costObjectType is not a recognized cost object type: ${identifier}`,
);

export const InvalidCategoryFilterError = createDomainError(
  "InvalidCategoryFilterError", "ACCOUNTING_INVALID_CATEGORY_FILTER",
  (identifier: string) => `Provided category value is not a recognized cost center category: ${identifier}`,
);

export const InvalidOrderTypeFilterError = createDomainError(
  "InvalidOrderTypeFilterError", "ACCOUNTING_INVALID_ORDER_TYPE_FILTER",
  (identifier: string) => `Provided orderType value is not OVERHEAD, INVESTMENT, or ACCRUAL: ${identifier}`,
);
