@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
70 lines (69 loc) • 3.21 kB
TypeScript
import { z } from "zod";
/** Unique string ID for classification given to sketches (e.g. zone classification, protection level) */
export type ClassificationId = string;
/** Unique name of objective */
export type ObjectiveId = string;
export declare const OBJECTIVE_YES = "yes";
export declare const OBJECTIVE_NO = "no";
export declare const OBJECTIVE_MAYBE = "maybe";
export declare const OBJECTIVE_GREEN = "#BEE4BE";
export declare const OBJECTIVE_YELLOW = "#FFE1A3";
export declare const OBJECTIVE_RED = "#F7A6B4";
/** Object mapping answers for whether sketch counts toward objective to stop light colors - green / yellow / red */
export declare const objectiveCountsColorMap: {
OBJECTIVE_YES: string;
OBJECTIVE_MAYBE: string;
OBJECTIVE_NO: string;
};
/** Readonly list of possible answers for whether sketch counts toward objective */
export declare const objectiveCountsAnswers: readonly ["yes", "no", "maybe"];
export declare const objectiveAnswerSchema: z.ZodEnum<["yes", "no", "maybe"]>;
export declare const objectiveAnswerMapSchema: z.ZodRecord<z.ZodString, z.ZodEnum<["yes", "no", "maybe"]>>;
/** Base planning objective, extend as needed for specific classification system or ad-hoc */
export declare const objectiveSchema: z.ZodObject<{
/** Unique identifier for objective */
objectiveId: z.ZodString;
shortDesc: z.ZodString;
/** Value required for objective to be met */
target: z.ZodNumber;
/** Generic map of group names (e.g. MPA protection levels) to whether they count towards objective */
countsToward: z.ZodRecord<z.ZodString, z.ZodEnum<["yes", "no", "maybe"]>>;
}, "strip", z.ZodTypeAny, {
objectiveId: string;
shortDesc: string;
target: number;
countsToward: Record<string, "yes" | "no" | "maybe">;
}, {
objectiveId: string;
shortDesc: string;
target: number;
countsToward: Record<string, "yes" | "no" | "maybe">;
}>;
export declare const objectivesSchema: z.ZodArray<z.ZodObject<{
/** Unique identifier for objective */
objectiveId: z.ZodString;
shortDesc: z.ZodString;
/** Value required for objective to be met */
target: z.ZodNumber;
/** Generic map of group names (e.g. MPA protection levels) to whether they count towards objective */
countsToward: z.ZodRecord<z.ZodString, z.ZodEnum<["yes", "no", "maybe"]>>;
}, "strip", z.ZodTypeAny, {
objectiveId: string;
shortDesc: string;
target: number;
countsToward: Record<string, "yes" | "no" | "maybe">;
}, {
objectiveId: string;
shortDesc: string;
target: number;
countsToward: Record<string, "yes" | "no" | "maybe">;
}>, "many">;
export type ObjectiveAnswer = z.infer<typeof objectiveAnswerSchema>;
export type Objective = z.infer<typeof objectiveSchema>;
export type Objectives = z.infer<typeof objectivesSchema>;
/** Range of possible answers for whether a classification counts towards or meets an objective */
/**
* Generic type for mapping classification ID to whether it counds toward or meets an objective
* Specific classification systems will extend this type with short list of allowed classification IDs
*/
export type ObjectiveAnswerMap = Record<ClassificationId, ObjectiveAnswer>;