UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

40 lines 1.57 kB
import { z } from "zod"; //// BASE OBJECTIVE //// export const OBJECTIVE_YES = "yes"; export const OBJECTIVE_NO = "no"; export const OBJECTIVE_MAYBE = "maybe"; export const OBJECTIVE_GREEN = "#BEE4BE"; export const OBJECTIVE_YELLOW = "#FFE1A3"; export const OBJECTIVE_RED = "#F7A6B4"; /** Object mapping answers for whether sketch counts toward objective to stop light colors - green / yellow / red */ export const objectiveCountsColorMap = { OBJECTIVE_YES: OBJECTIVE_GREEN, OBJECTIVE_MAYBE: OBJECTIVE_YELLOW, OBJECTIVE_NO: OBJECTIVE_RED, }; /** Readonly list of possible answers for whether sketch counts toward objective */ export const objectiveCountsAnswers = [ OBJECTIVE_YES, OBJECTIVE_NO, OBJECTIVE_MAYBE, ]; //// SCHEMA //// const OBJECTIVE_COUNTS_ANSWERS = [ OBJECTIVE_YES, OBJECTIVE_NO, OBJECTIVE_MAYBE, ]; export const objectiveAnswerSchema = z.enum(OBJECTIVE_COUNTS_ANSWERS); export const objectiveAnswerMapSchema = z.record(objectiveAnswerSchema); /** Base planning objective, extend as needed for specific classification system or ad-hoc */ export const objectiveSchema = z.object({ /** Unique identifier for objective */ objectiveId: z.string(), shortDesc: z.string(), /** Value required for objective to be met */ target: z.number().nonnegative(), /** Generic map of group names (e.g. MPA protection levels) to whether they count towards objective */ countsToward: objectiveAnswerMapSchema, }); export const objectivesSchema = z.array(objectiveSchema); //# sourceMappingURL=objective.js.map