analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
85 lines • 3.5 kB
TypeScript
import type { LessonFiltersData } from '../../types/lessonFilters';
import type { Lesson } from '../../types/lessons';
import type { LessonBackendFiltersFormat } from './RecommendedLessonCreate.types';
import { RecommendedClassDraftType } from './RecommendedLessonCreate.types';
/**
* Knowledge area interface for subject lookup
*/
export interface KnowledgeArea {
id: string;
name: string;
}
/**
* Preview lesson type for LessonPreview component
* Includes media fields mapped from API response
*/
export interface PreviewLesson extends Lesson {
position?: number;
videoSrc?: string;
videoPoster?: string;
videoSubtitles?: string;
podcastSrc?: string;
podcastTitle?: string;
}
/**
* Convert LessonFiltersData to backend format
*
* @param filters - LessonFiltersData to convert, can be null
* @returns LessonBackendFiltersFormat object with converted filter data
*/
export declare function convertFiltersToBackendFormat(filters: LessonFiltersData | null): LessonBackendFiltersFormat;
/**
* Convert backend filters format to LessonFiltersData
*
* @param backendFilters - LessonBackendFiltersFormat to convert, can be null
* @returns LessonFiltersData object with converted filter data, or null if input is null
*/
export declare function convertBackendFiltersToLessonFiltersData(backendFilters: LessonBackendFiltersFormat | null): LessonFiltersData | null;
/**
* Get subject name from subjectId by searching in knowledge areas
*
* @param subjectId - The subject ID to look up
* @param knowledgeAreas - Array of knowledge areas to search in
* @returns The subject name if found, null otherwise
*/
export declare function getSubjectName(subjectId: string | null, knowledgeAreas: KnowledgeArea[]): string | null;
/**
* Get goal draft type label using object literal mapping
*
* @param type - RecommendedClassDraftType enum value
* @returns Label string for the goal draft type
*/
export declare function getGoalDraftTypeLabel(type: RecommendedClassDraftType): string;
/**
* Generate recommended lesson title based on type, subject, first lesson, and date
*
* @param type - RecommendedClassDraftType enum value
* @param subjectId - Subject ID to get name from
* @param knowledgeAreas - Array of knowledge areas for subject lookup
* @param lessons - Array of lessons (optional, to get first lesson name)
* @returns Generated title string
*/
export declare function generateTitle(type: RecommendedClassDraftType, subjectId: string | null, knowledgeAreas: KnowledgeArea[], lessons?: Lesson[]): string;
/**
* Convert RecommendedClassDraftType to the format used in URL
*
* @param type - RecommendedClassDraftType enum value
* @returns String representation for URL (rascunho or modelo)
*/
export declare function getTypeFromUrl(type: RecommendedClassDraftType): string;
/**
* Convert string from URL to RecommendedClassDraftType
*
* @param type - String from URL (rascunho or modelo)
* @returns RecommendedClassDraftType enum value
*/
export declare function getTypeFromUrlString(type: string | undefined): RecommendedClassDraftType;
/**
* Convert Lesson to PreviewLesson format
* Maps API fields (urlVideo, urlPodCast, etc.) to component-expected fields (videoSrc, podcastSrc, etc.)
*
* @param lesson - Lesson object to convert
* @returns PreviewLesson object with converted data
*/
export declare function convertLessonToPreview(lesson: Lesson): PreviewLesson;
//# sourceMappingURL=RecommendedLessonCreate.utils.d.ts.map