Spaces:
Running
Running
| // ββ Geometry ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| export interface Location { | |
| page: number | |
| /** [x0%, y0%, x1%, y1%] β top-left origin, 0β100 range, percent of page */ | |
| bbox: [number, number, number, number] | |
| } | |
| export interface FieldProvenance { | |
| field_path: string | |
| extracted_value: string | |
| matched_text: string | |
| /** 0.0β1.0 */ | |
| match_score: number | |
| source_filename: string | |
| location: Location | |
| } | |
| // ββ Golden Record sub-types βββββββββββββββββββββββββββββββββββββββββββββββ | |
| export interface PeriodOfCover { | |
| start_date?: string | |
| expiry_date?: string | |
| issue_date?: string | |
| } | |
| export interface PolicyHeader { | |
| policy_number?: string | |
| insurer?: string | |
| product_name?: string | |
| period_of_cover?: PeriodOfCover | |
| } | |
| export interface SecurityDetails { | |
| has_security_device?: boolean | |
| tracker_fitted?: boolean | |
| modifications?: string | |
| } | |
| export interface VehicleDetails { | |
| vrm?: string | |
| make?: string | |
| model?: string | |
| fuel_type?: string | |
| transmission?: string | |
| estimated_value?: string | |
| annual_mileage?: number | |
| overnight_postcode?: string | |
| kept_location?: string | |
| security?: SecurityDetails | |
| } | |
| export interface Driver { | |
| name: string | |
| dob?: string | |
| relationship?: string | |
| occupation?: string | |
| license_type?: string | |
| is_main_driver: boolean | |
| specific_excess?: number | |
| } | |
| export interface NoClaimsDiscount { | |
| years?: number | |
| protected?: boolean | |
| } | |
| export interface ExcessBreakdown { | |
| standard_compulsory?: number | |
| voluntary?: number | |
| total_accidental_damage?: number | |
| fire?: number | |
| theft?: number | |
| windscreen_repair?: number | |
| windscreen_replacement?: number | |
| own_repairer_additional_excess?: number | |
| } | |
| export interface CoverAndExcesses { | |
| cover_type?: string | |
| class_of_use?: string | |
| driving_other_cars?: boolean | |
| no_claims_discount?: NoClaimsDiscount | |
| excess_breakdown?: ExcessBreakdown | |
| } | |
| export interface OptionalExtras { | |
| motor_legal_protection?: number | string | |
| breakdown_roadside_assistance?: number | string | |
| enhanced_personal_accident?: number | string | |
| hire_car?: number | string | |
| key_cover?: number | string | |
| } | |
| export interface FinancialSummary { | |
| total_annual_premium?: number | |
| optional_extras?: OptionalExtras | |
| } | |
| export interface AdditionalRiskData { | |
| home_ownership?: string | |
| children_under_16?: boolean | |
| number_of_cars_in_household?: number | |
| non_motoring_convictions?: boolean | |
| endorsements?: string | |
| } | |
| export interface Citations { | |
| vehicle_model?: string | |
| excess_details?: string | |
| class_of_use?: string | |
| driver_ages?: string | |
| premium_breakdown?: string | |
| } | |
| export interface GoldenRecord { | |
| policy_header?: PolicyHeader | |
| vehicle_details?: VehicleDetails | |
| driver_details: Driver[] | |
| cover_and_excesses?: CoverAndExcesses | |
| financial_summary?: FinancialSummary | |
| additional_risk_data?: AdditionalRiskData | |
| citations?: Citations | |
| } | |
| export interface ConflictEntry { | |
| field: string | |
| schedule_value?: string | |
| certificate_value?: string | |
| winner: 'schedule' | 'certificate' | 'fallback' | string | |
| } | |
| // ββ Session βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| export interface SessionData { | |
| record: GoldenRecord | |
| provenance: FieldProvenance[] | |
| conflicts?: ConflictEntry[] | |
| session_id: string | |
| } | |
| // ββ Review state ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| export type ReviewAction = 'verify' | 'reject' | 'override' | |
| export interface FieldReview { | |
| action: ReviewAction | |
| overridden_value?: string | |
| reviewer?: string | |
| } | |
| export type ReviewState = Record<string, FieldReview> | |
| // ββ Flat field entry (used by the form panel) βββββββββββββββββββββββββββββ | |
| export interface FieldEntry { | |
| fieldPath: string | |
| label: string | |
| value: string | null | |
| section: string | |
| provenance?: FieldProvenance | |
| } | |
| // ββ API response types ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| export interface ProcessResponse { | |
| session_id: string | |
| fields_extracted: number | |
| provenance_coverage: number | |
| } | |