// Core-level canonical status enum to be shared across layers
export enum Status {
  Disabled = 0,
  Enabled = 1,
}

export type StatusName = 'disabled' | 'enabled';

export const StatusNameMap: Record<Status, StatusName> = {
  [Status.Disabled]: 'disabled',
  [Status.Enabled]: 'enabled',
};

export function isEnabledStatus(
  input: Status | StatusName | number | string | null | undefined,
): boolean {
  if (input === null || input === undefined) return false;
  if (typeof input === 'number') return Number(input) === Status.Enabled;
  if (typeof input === 'string') return input === 'enabled' || input === '1';
  return input === Status.Enabled;
}
