import { ColonyStatus, Prisma } from '../../generated/prisma'; /** * Statuses after which a colony no longer exists as a living unit. The other * statuses (ACTIVE, WEAK, CONSPICUOUS, QUEENLESS) describe a colony that is * still in the apiary and can be worked with - a weak colony still gets moved, * and a queenless one is exactly the colony a beekeeper unites with another. */ export const TERMINAL_COLONY_STATUSES: readonly ColonyStatus[] = [ 'DISSOLVED', 'SOLD', 'DECEASED', 'MERGED', ]; export function isLivingColonyStatus(status: ColonyStatus): boolean { return !TERMINAL_COLONY_STATUSES.includes(status); } /** The same rule as a query filter: colonies that still exist. */ export const LIVING_COLONY_WHERE = { status: { notIn: [...TERMINAL_COLONY_STATUSES] }, } satisfies Prisma.ColonyWhereInput;