import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { StoreDocumentStatus } from '../../../common/enum/document.enum'; /** Contrato com o painel: IExternalDocumentVersion. */ export class DocumentVersionResponseDto { @ApiProperty() id: string; @ApiProperty() fileName: string; @ApiProperty() fileSize: number; @ApiProperty() issueDate: string; @ApiProperty({ nullable: true, type: 'string' }) expiryDate: string | null; @ApiPropertyOptional({ nullable: true, type: 'string' }) documentNumber?: string | null; @ApiProperty() uploadedAt: string; @ApiPropertyOptional({ nullable: true, type: 'string' }) uploadedBy?: string | null; @ApiPropertyOptional({ description: 'URL assinada de vida curta — nunca persistir', nullable: true, type: 'string', }) fileUrl?: string | null; } export class RenewalProtocolDto { @ApiProperty() protocolNumber: string; @ApiProperty() protocolDate: string; } /** Contrato com o painel: IExternalStoreDocument. */ export class StoreDocumentResponseDto { @ApiProperty() id: string; @ApiProperty() typeCode: string; @ApiProperty() storeId: string; @ApiProperty({ enum: StoreDocumentStatus }) status: StoreDocumentStatus; @ApiProperty({ nullable: true, type: 'string' }) issueDate: string | null; @ApiProperty({ nullable: true, type: 'string' }) expiryDate: string | null; @ApiPropertyOptional({ nullable: true, type: 'string' }) documentNumber?: string | null; @ApiPropertyOptional({ nullable: true, type: 'string' }) responsible?: string | null; @ApiPropertyOptional({ nullable: true, type: 'string' }) notes?: string | null; @ApiPropertyOptional({ nullable: true, type: RenewalProtocolDto }) renewalProtocol?: RenewalProtocolDto | null; @ApiProperty({ type: [DocumentVersionResponseDto] }) versions: DocumentVersionResponseDto[]; } export class StoreDocumentListResponseDto { @ApiProperty({ type: [StoreDocumentResponseDto] }) data: StoreDocumentResponseDto[]; @ApiProperty() count: number; } /** Contrato com o painel: IExternalAnalysisResult. */ export class AnalysisResultResponseDto { @ApiProperty({ nullable: true, type: 'string' }) suggestedTypeCode: string | null; @ApiProperty() confidence: number; @ApiProperty() detectedFields: { issueDate?: string | null; expiryDate?: string | null; documentNumber?: string | null; }; @ApiPropertyOptional({ description: 'Confiança 0–1 por campo (análise por LLM)', nullable: true, }) fieldConfidences?: { issueDate?: number; expiryDate?: number; documentNumber?: number; } | null; @ApiPropertyOptional({ description: 'Trecho literal do documento de onde cada campo saiu', nullable: true, }) evidence?: { issueDate?: string; expiryDate?: string; documentNumber?: string; } | null; @ApiProperty({ type: [String] }) warnings: string[]; }