/**
 * The maps define a minimal manufacturing state that allows for assertions
 * of certain minimal requirements in code that should be agostic w.r.t. the
 * actual context (e.g. gui vs. shop).
 */

import {
	ConstraintLevelMap,
	Level,
	ReplyStateLevelMap,
} from "qrc:/js/lib/manufacturing_state";

export const minReplyStateLevelMap: ReplyStateLevelMap = {
	undefined: {
		undefinedError: Level.fatalError,
	},
	userDefined: {
		undefinedError: Level.fatalError,
	},
	tubeCutting: {
		undefinedError: Level.fatalError,
		undetectedFeatures: Level.warning,
	},
	userDefinedBase: {
		undefinedError: Level.fatalError,
	},
	sheet: {
		undefinedError: Level.fatalError,
		nestingFailed: Level.recoverableError,
	},
	sheetBending: {
		undefinedError: Level.recoverableError,
		undetectedFeatures: Level.warning,
		multipleOuterContours: Level.warning,
		invalidBend: Level.fatalError,
		contourInBend: Level.warning,
	},
	packaging: {
		undefinedError: Level.fatalError,
		insufficientPackageVolume: Level.fatalError,
		overweightParts: Level.fatalError,
	},
	sheetCutting: {
		undefinedError: Level.fatalError,
		undetectedFeatures: Level.warning,
		multipleOuterContours: Level.warning,
		unused0: Level.fatalError,
	},
	joining: {
		undefinedError: Level.fatalError,
	},
	transform: {
		undefinedError: Level.fatalError,
	},
	tube: {
		undefinedError: Level.fatalError,
	},
};

export const minConstraintLevelMap: ConstraintLevelMap = {
	bendAreasNotOverlapping: Level.warning,
	bendDie: Level.warning,
	bendThickness: Level.warning,
	dataCompleteness: Level.warning,
	dataConsistent: Level.recoverableError,
	dataValidity: Level.recoverableError,
	maxBendLineNetLength: Level.warning,
	maxDimensions: Level.warning,
	maxSheetThickness: Level.warning,
	minContourSize: Level.warning,
	profileSupport: Level.fatalError,
	sheetAvailability: Level.recoverableError,
	sheetMaterialAvailability: Level.recoverableError,
	transportSource: Level.recoverableError,
	tubeAvailability: Level.recoverableError,
	tubeCuttingProcessCompatibility: Level.recoverableError,
	tubeDetectionLicensed: Level.recoverableError,
	tubeNestingAvailability: Level.recoverableError,
	userDefinedProcessId: Level.recoverableError,
};
