All files / src/schemas formSchema.ts

0% Statements 0/0
0% Branches 1/1
0% Functions 1/1
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106                                                                                                                                                                                                                   
/**
 * Valores posibles para las respuestas de auditoría
 * Se reciben 4 constantes y un número
 * - 'yes': Cumple con la pregunta
 * - 'partial': Cumple parcialmente con la pregunta
 * - 'no': No cumple con la pregunta
 * - 'na': No aplica la pregunta
 * - number: Porcentaje de cumplimiento
 */
export type OptionValue = 'yes' | 'partial' | 'no' | 'na' | number;
 
/**
 * Opciones disponibles para las preguntas
 */
export interface Option {
	value: OptionValue;
	label: string;
	description: string;
}
 
/**
 * Pregunta de auditoría
 */
export interface Question {
	id: string;
	text: string;
	options: Option[];
	response: OptionValue | null;
	observations: string;
	evidence_url: string;
}
 
/**
 * Subsección de auditoría
 */
export interface Subsection {
	subsection: string;
	title: string;
	questions: Question[];
}
 
/**
 * Sección principal de auditoría
 */
export interface Section {
	section: string;
	title: string;
	subsections: Subsection[];
}
 
/**
 * Estructura completa de una auditoría NIST
 */
export interface NistAudit {
	program: string;
	sections: Section[];
}
 
/**
 * Resultado de auditoría procesado
 */
export interface AuditResult {
	id: string;
	program: string;
	auditDate: Date;
	completionPercentage: number;
	createdAt?: Date;
	sections: {
		[sectionId: string]: {
			title: string;
			completionPercentage: number;
			questions: {
				[questionId: string]: {
					text: string;
					response: OptionValue | null;
					observations: string;
					evidence_url: string;
				};
			};
		};
	};
	sectionTitles?: {
		[sectionId: string]: string;
	};
	subsectionTitles?: {
		[subsectionId: string]: string;
	};
}
 
/**
 * Respuesta básica para APIs
 */
export interface ApiResponse {
	success: boolean;
	message?: string;
}
 
/**
 * Error de API
 */
export interface ApiError extends ApiResponse {
	success: false;
	message: string;
	errorCode: string;
}