//#region src/services/AchievementValidator.d.ts /** * Achievement Validator Service * * Validates Achievement structures before credential issuance according to * OpenBadges 3.0 specification requirements. * * @see https://www.imsglobal.org/spec/ob/v3p0/#achievement */ /** * Result of an achievement validation */ interface ValidationResult { /** Whether the achievement is valid */ valid: boolean; /** Critical errors that must be fixed */ errors: string[]; /** Recommendations that don't prevent issuance */ warnings: string[]; } /** * Image object structure */ interface AchievementImage { /** URI of the image */ id: string; /** Must be 'Image' */ type?: 'Image'; /** Caption for the image */ caption?: string; } /** * Criteria for achieving the achievement */ interface AchievementCriteria { /** URI to criteria document */ id?: string; /** Human-readable narrative describing how to achieve */ narrative?: string; } /** * Alignment to external standards or frameworks */ interface Alignment { /** Must be 'Alignment' */ type: 'Alignment'; /** Name of the target standard/framework */ targetName: string; /** URL of the target standard/framework */ targetUrl: string; /** Description of the target */ targetDescription?: string; /** Name of the framework */ targetFramework?: string; /** Code within the framework */ targetCode?: string; } /** * Related achievement reference */ interface Related { /** URI of the related achievement */ id: string; /** Type (should include 'Related') */ type?: string | string[]; /** Optional version */ version?: string; } /** * Result description for rubric-based achievements */ interface ResultDescription { /** URI for this result description */ id: string; /** Must be 'ResultDescription' */ type: 'ResultDescription'; /** Name of the result */ name: string; /** Rubric criteria text */ resultType?: string; } /** * Achievement structure as per OpenBadges 3.0 spec */ interface Achievement { /** Must include 'Achievement' */ type: 'Achievement' | ['Achievement', ...string[]]; /** URI identifying this achievement */ id?: string; /** Name of the achievement (REQUIRED) */ name: string; /** Description of the achievement */ description?: string; /** Criteria for earning this achievement */ criteria?: AchievementCriteria; /** Image representing the achievement */ image?: AchievementImage | string; /** Type of achievement (e.g., 'Certificate', 'Badge') */ achievementType?: string; /** Alignment to external frameworks */ alignment?: Alignment[]; /** Creator/issuer of the achievement definition */ creator?: { id: string; type?: string; name?: string; }; /** Evidence requirements */ creditsAvailable?: number; /** Human-readable code */ humanCode?: string; /** Related achievements */ related?: Related[]; /** Result descriptions for rubrics */ resultDescription?: ResultDescription[]; /** Specialization of another achievement */ specialization?: string; /** Tags for categorization */ tag?: string[]; /** Version of the achievement */ version?: string; } /** * Validates Achievement structures before credential issuance */ declare class AchievementValidator { /** * Validates the basic structure of an Achievement * Checks for required fields and correct types */ validateStructure(achievement: Partial): ValidationResult; /** * Validates achievement criteria * Criteria must have either an id (URL) or a narrative, preferably both */ validateCriteria(achievement: Partial): ValidationResult; /** * Validates achievement image */ validateImage(achievement: Partial): ValidationResult; /** * Validates alignment array */ validateAlignment(alignments: Alignment[] | undefined): ValidationResult; /** * Validates result descriptions (for rubric-based achievements) */ validateResultDescriptions(resultDescriptions: ResultDescription[] | undefined): ValidationResult; /** * Validates all aspects of an Achievement * Combines structure, criteria, image, and alignment validation */ validateAll(achievement: Partial): ValidationResult; /** * Quick check if an achievement is minimally valid * Only checks required fields, not recommendations */ isValid(achievement: Partial): boolean; } //#endregion export { Achievement, AchievementCriteria, AchievementImage, AchievementValidator, Alignment, Related, ResultDescription, ValidationResult }; //# sourceMappingURL=AchievementValidator.d.mts.map