import type { Character, MapToken } from '@/lib/schemas';

export type TokenSpec = Omit<MapToken, 'id'>;

export const KIND_COLOR: Record<MapToken['kind'], string> = {
  pc: '#64b5f6', npc: '#66bb6a', monster: '#ef5350', object: '#bdbdbd',
};

export function baseSpec(over: Partial<TokenSpec>): TokenSpec {
  return { label: '', color: '#d4af37', col: 0, row: 0, size: 1, kind: 'npc', conditions: [], gmOnly: false, ...over };
}

/** PCs that don't already have a linked token on the map (for "+ All"). */
export function unplacedPcs(pcs: Character[], existingTokens: Pick<MapToken, 'characterId'>[]): Character[] {
  return pcs.filter((c) => !existingTokens.some((t) => t.characterId === c.id));
}
