documents/src/modules/document/dto/response/documentResponse.dto.ts
Breno Pires 50a2d0b628 feat(analyze): extracao por LLM com confianca por campo e dupla passada em datas
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 02:41:39 -03:00

129 lines
2.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 01 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[];
}