import { Head, Link } from '@inertiajs/react'; import { PortalMenu } from '@/layouts/portal-navigation'; type DocumentResource = { title: string; description: string | null; category: string; topic: string; document_type: string; document_number: string | null; document_date: string | null; applicable_from: string | null; applicable_until: string | null; source_url: string | null; language: string; version_label: string | null; territorial_scope: string; territory_name: string | null; source_confirmation: string; legal_status: string; source_reference: string; issuer: string | null; file_name: string; version_no: number; size_bytes: number | null; view_url: string | null; links: { target_type: string; target_key: string; target_label?: string | null; relationship: string; applicability: string; condition_text: string | null; basis_reference: string | null; review_status: string; }[]; }; const modulePaths: Record = { simulator: { href: '/simulador-fiscal', label: 'Simulador fiscal' }, investment: { href: '/oportunidades', label: 'Oportunidades de investimento', }, zones: { href: '/zonas', label: 'ZEE, ZFI e parques industriais' }, education: { href: '/educacao', label: 'Educação e competências' }, business: { href: '/negocios', label: 'Negócios' }, land: { href: '/investidor/terra-duat', label: 'Terra e DUAT' }, }; const documentTypeLabels: Record = { legislation: 'Legislação', procedure: 'Procedimento oficial', official_form: 'Formulário oficial', digital_adaptation: 'Adaptação digital de formulário', guidance_template: 'Modelo orientativo', guide: 'Guia', study: 'Estudo', reference_data: 'Dados de referência', unknown: 'Tipo por classificar', }; const legalStatusLabels: Record = { not_applicable: 'Não aplicável', in_force: 'Vigência indicada; confirme o período', historical: 'Histórico', proposed: 'Proposta; não é norma vigente', repealed: 'Revogada', amended: 'Alterada; consulte alterações posteriores', unknown: 'Por confirmar', }; export default function DocumentPage({ resource, backUrl, downloadUrl, }: { resource: DocumentResource; backUrl: string; downloadUrl: string; }) { return (
← Voltar à pesquisa

Consulta: documento disponível nesta ficha pelas condições de acesso existentes. Referências pendentes não impedem a consulta autorizada.

Situação jurídica:{' '} {legalStatusLabels[resource.legal_status] ?? 'Por confirmar'} . A autorização de consulta não valida vigência ou aplicabilidade.

Utilização em cálculos: esta ficha e as suas associações não ativam regras fiscais. A utilização efetiva exige verificação independente no calculador.

Versão do registo:{' '} {resource.version_no} ·{' '} {resource.version_label ?? 'Edição por confirmar'}

Proveniência registada:{' '} {resource.source_url ?? 'Não indicada; confirmação pendente'}

{resource.category} · {resource.topic}

{resource.title}

{resource.description && (

{resource.description}

)}
Tipo documental
{documentTypeLabels[resource.document_type] ?? resource.document_type}
Entidade emitente / autor
{resource.issuer ?? 'Não indicada'}
Número e data
{[ resource.document_number, resource.document_date, ] .filter(Boolean) .join(' · ') || 'Não indicados'}
Período de aplicação documentado
{resource.applicable_from || resource.applicable_until ? `${resource.applicable_from ?? 'Início não indicado'} — ${resource.applicable_until ?? 'Sem data final indicada'}` : 'Não registado'}
Versão e idioma
{resource.version_label ?? 'Versão não indicada'}{' '} · {resource.language}
Âmbito
{resource.territorial_scope === 'national' ? 'Nacional' : (resource.territory_name ?? 'Por confirmar')}
Situação documental
{legalStatusLabels[resource.legal_status] ?? resource.legal_status}
Fonte
{resource.source_confirmation === 'official_confirmed' ? 'Fonte oficial confirmada' : resource.source_confirmation === 'identified' ? 'Origem identificada' : 'Por confirmar'}
{resource.source_confirmation === 'identified' && (

A origem está identificada, mas a autenticidade desta cópia não foi confirmada independentemente. Consulte a fonte indicada.

)}

Referência: {resource.source_reference}

{resource.links.length > 0 && (

Base legal e documentos relacionados no portal

    {resource.links.map((link, index) => { const destination = link.target_type === 'module' ? modulePaths[link.target_key] : undefined; return (
  • {destination ? ( {destination.label} ) : ( {link.target_type === 'requirement' ? `Requisito documental: ${link.target_label ?? link.target_key}` : `${link.target_type}: ${link.target_key}`} )} {' · '} {link.applicability === 'evidence' ? 'evidência documental' : link.applicability} {link.condition_text && ( {' '} · Condição:{' '} {link.condition_text} )} {link.basis_reference && ( {' '} · Referência documental (não é regra fiscal):{' '} {link.basis_reference} )} {link.review_status === 'confirmed' ? ( {' '} · Citação conferida no ficheiro; aplicação fiscal pendente ) : ( {' '} · Pendente de conferência; não constitui fundamento confirmado )}
  • ); })}
)}

A disponibilização desta referência não certifica vigência, elegibilidade, viabilidade ou aprovação oficial. Consulte o diploma ou a entidade competente para confirmar a sua aplicação ao caso concreto.

); }