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

export const AccountNotFoundError = createDomainError(
  "AccountNotFoundError", "COA_MANAGEMENT_ACCOUNT_NOT_FOUND",
  (identifier: string) => `Specified account ID does not exist: ${identifier}`,
);

export const ChartOfAccountsNotActiveError = createDomainError(
  "ChartOfAccountsNotActiveError", "COA_MANAGEMENT_CHART_OF_ACCOUNTS_NOT_ACTIVE",
  (identifier: string) => `Parent CoA is not in ACTIVE status; account activation requires the CoA to be ACTIVE: ${identifier}`,
);

export const InvalidStateTransitionError = createDomainError(
  "InvalidStateTransitionError", "COA_MANAGEMENT_INVALID_STATE_TRANSITION",
  (identifier: string) => `Entity is not in the required status for the requested state transition: ${identifier}`,
);

export const ChartOfAccountsNotFoundError = createDomainError(
  "ChartOfAccountsNotFoundError", "COA_MANAGEMENT_CHART_OF_ACCOUNTS_NOT_FOUND",
  (identifier: string) => `Specified CoA ID does not exist: ${identifier}`,
);

export const DuplicateActiveChartOfAccountsError = createDomainError(
  "DuplicateActiveChartOfAccountsError", "COA_MANAGEMENT_DUPLICATE_ACTIVE_CHART_OF_ACCOUNTS",
  (identifier: string) => `Another ACTIVE CoA already exists for the same company: ${identifier}`,
);

export const DuplicateAccountCodeError = createDomainError(
  "DuplicateAccountCodeError", "COA_MANAGEMENT_DUPLICATE_ACCOUNT_CODE",
  (identifier: string) => `An account with the same code already exists in the CoA: ${identifier}`,
);

export const IncompatibleClassificationError = createDomainError(
  "IncompatibleClassificationError", "COA_MANAGEMENT_INCOMPATIBLE_CLASSIFICATION",
  (identifier: string) => `Account classification is not compatible with the account type: ${identifier}`,
);

export const DuplicateRetainedEarningsError = createDomainError(
  "DuplicateRetainedEarningsError", "COA_MANAGEMENT_DUPLICATE_RETAINED_EARNINGS",
  (identifier: string) => `Another account in the CoA already has RETAINED_EARNINGS classification: ${identifier}`,
);

export const CurrencyNotFoundError = createDomainError(
  "CurrencyNotFoundError", "COA_MANAGEMENT_CURRENCY_NOT_FOUND",
  (identifier: string) => `Referenced currency does not exist or is not active: ${identifier}`,
);

export const AccountGroupNotFoundError = createDomainError(
  "AccountGroupNotFoundError", "COA_MANAGEMENT_ACCOUNT_GROUP_NOT_FOUND",
  (identifier: string) => `Referenced account group does not exist or belongs to a different CoA: ${identifier}`,
);

export const CodeOutOfRangeError = createDomainError(
  "CodeOutOfRangeError", "COA_MANAGEMENT_CODE_OUT_OF_RANGE",
  (identifier: string) => `Account code does not fall within the assigned group's number range: ${identifier}`,
);

export const NameRequiredError = createDomainError(
  "NameRequiredError", "COA_MANAGEMENT_NAME_REQUIRED",
  (identifier: string) => `Account name is empty or not provided: ${identifier}`,
);

export const InvalidAccountCodeError = createDomainError(
  "InvalidAccountCodeError", "COA_MANAGEMENT_INVALID_ACCOUNT_CODE",
  (identifier: string) => `Account code is not a valid structured numeric identifier: ${identifier}`,
);

export const ReconciliationRequiredError = createDomainError(
  "ReconciliationRequiredError", "COA_MANAGEMENT_RECONCILIATION_REQUIRED",
  (identifier: string) => `Reconciliation cannot be set to false for RECEIVABLE, PAYABLE, or BANK_CASH classifications: ${identifier}`,
);

export const ChartOfAccountsArchivedError = createDomainError(
  "ChartOfAccountsArchivedError", "COA_MANAGEMENT_CHART_OF_ACCOUNTS_ARCHIVED",
  (identifier: string) => `Parent CoA is in ARCHIVED status; no modifications are permitted: ${identifier}`,
);

export const CodeRequiredError = createDomainError(
  "CodeRequiredError", "COA_MANAGEMENT_CODE_REQUIRED",
  (identifier: string) => `Group code is empty or not provided: ${identifier}`,
);

export const DuplicateGroupCodeError = createDomainError(
  "DuplicateGroupCodeError", "COA_MANAGEMENT_DUPLICATE_GROUP_CODE",
  (identifier: string) => `A group with the same code already exists in the CoA: ${identifier}`,
);

export const ParentGroupNotFoundError = createDomainError(
  "ParentGroupNotFoundError", "COA_MANAGEMENT_PARENT_GROUP_NOT_FOUND",
  (identifier: string) => `Specified parent group does not exist or belongs to a different CoA: ${identifier}`,
);

export const InvalidNumberRangeError = createDomainError(
  "InvalidNumberRangeError", "COA_MANAGEMENT_INVALID_NUMBER_RANGE",
  (identifier: string) => `Number range is invalid (start >= end) or overlaps with another group's range: ${identifier}`,
);

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

export const TemplateNotFoundError = createDomainError(
  "TemplateNotFoundError", "COA_MANAGEMENT_TEMPLATE_NOT_FOUND",
  (identifier: string) => `Specified templateId does not reference a valid template in the template provider: ${identifier}`,
);

export const TemplateProviderNotConfiguredError = createDomainError(
  "TemplateProviderNotConfiguredError", "COA_MANAGEMENT_TEMPLATE_PROVIDER_NOT_CONFIGURED",
  (identifier: string) => `templateId was provided but no template provider is configured: ${identifier}`,
);

export const OpenBalancesExistError = createDomainError(
  "OpenBalancesExistError", "COA_MANAGEMENT_OPEN_BALANCES_EXIST",
  (identifier: string) => `Pre-deactivation hook reports open or unreconciled balances (GL module integration): ${identifier}`,
);

export const SuccessorNotActiveError = createDomainError(
  "SuccessorNotActiveError", "COA_MANAGEMENT_SUCCESSOR_NOT_ACTIVE",
  (identifier: string) => `Specified successor account is not in ACTIVE status: ${identifier}`,
);

export const HasPostedTransactionsError = createDomainError(
  "HasPostedTransactionsError", "COA_MANAGEMENT_HAS_POSTED_TRANSACTIONS",
  (identifier: string) => `Account has posted transactions and cannot be deleted: ${identifier}`,
);

export const HasChildGroupsError = createDomainError(
  "HasChildGroupsError", "COA_MANAGEMENT_HAS_CHILD_GROUPS",
  (identifier: string) => `Group contains child groups and cannot be deleted: ${identifier}`,
);

export const HasAssignedAccountsError = createDomainError(
  "HasAssignedAccountsError", "COA_MANAGEMENT_HAS_ASSIGNED_ACCOUNTS",
  (identifier: string) => `Group has accounts assigned to it and cannot be deleted: ${identifier}`,
);

export const CircularReferenceError = createDomainError(
  "CircularReferenceError", "COA_MANAGEMENT_CIRCULAR_REFERENCE",
  (identifier: string) => `New parent is the group itself or one of its descendants: ${identifier}`,
);

export const StructuralFieldImmutableError = createDomainError(
  "StructuralFieldImmutableError", "COA_MANAGEMENT_STRUCTURAL_FIELD_IMMUTABLE",
  (identifier: string) => `Attempted to change a structural field on an account with posted transactions: ${identifier}`,
);

export const AccountsOutOfRangeError = createDomainError(
  "AccountsOutOfRangeError", "COA_MANAGEMENT_ACCOUNTS_OUT_OF_RANGE",
  (identifier: string) => `Existing assigned accounts have codes outside the new number range: ${identifier}`,
);

export const SelfReferenceError = createDomainError(
  "SelfReferenceError", "COA_MANAGEMENT_SELF_REFERENCE",
  (identifier: string) => `Group is moved to itself as parent — returns isCircular: true: ${identifier}`,
);

export const EmptyResultError = createDomainError(
  "EmptyResultError", "COA_MANAGEMENT_EMPTY_RESULT",
  (identifier: string) => `No groups match the given criteria — returns empty list: ${identifier}`,
);
