/** Отношение НПС: задаёт цвет кольца токена. */

export const NPC_DISPOSITIONS = ['hostile', 'neutral', 'friendly'] as const;
export type NpcDisposition = (typeof NPC_DISPOSITIONS)[number];

export const DEFAULT_NPC_DISPOSITION: NpcDisposition = 'neutral';

export const NPC_DISPOSITION_RING_COLOR: Record<NpcDisposition, string> = {
  hostile: '#e53935',
  neutral: '#c9a227',
  friendly: '#43a047',
};

/** Серый для session-only «Неактивен». */
export const NPC_INACTIVE_RING_COLOR = '#9e9e9e';

export function normalizeNpcDisposition(raw: unknown): NpcDisposition {
  if (raw === 'hostile' || raw === 'friendly' || raw === 'neutral') return raw;
  return DEFAULT_NPC_DISPOSITION;
}

export function npcDispositionRingColor(disposition: NpcDisposition, inactive = false): string {
  if (inactive) return NPC_INACTIVE_RING_COLOR;
  return NPC_DISPOSITION_RING_COLOR[disposition];
}

export function otherNpcDispositions(current: NpcDisposition): NpcDisposition[] {
  return NPC_DISPOSITIONS.filter((d) => d !== current);
}
