Files
yara724api/docs/fanavaran-vehicle-review.md
T

3.7 KiB

Fanavaran vehicle review gate

Fanavaran vehicle values returned by external inquiries are advisory only. No outbound Fanavaran stage may create or upload data until an authorized claim-panel actor has approved all four vehicle values.

Reviewed values

UI field Fanavaran source Stored value
نوع خودرو vehicle-groups fanavaranVehicleReview.vehicleGroup
نوع استفاده vehicle-use-types fanavaranVehicleReview.vehicleUseType
سیستم خودرو vehicle-systems fanavaranVehicleReview.vehicleSystem
نام خودرو filtered vehicle-kinds cache fanavaranVehicleReview.vehicleKind

The persisted review is an authoritative snapshot containing IDs, captions, relationship IDs, reviewer identity/role, approval time, and a monotonically increasing version. vehicleUseType.id is used as GEN.03/GEN.12 AccidentVehicleUsedId; vehicleKind.id is used as GEN.12 VehicleKindId.

Inquiry prefill and trust boundary

The options response also includes an unapproved suggestion. It is built from the damaged party's role-specific inquiry snapshot and never writes to fanavaranVehicleReview by itself.

Matching order:

  1. A direct Fanavaran VehicleKindId/vehicle.vehicleKind.Id is validated against the active vehicle-kinds cache. Its VehicleGroupId and VehicleSystemId relationships provide the group and system.
  2. A direct Fanavaran UsedId/vehicle.used.Id is accepted only when it is active and belongs to the matched vehicle group.
  3. Otherwise semantic inquiry captions are normalized (Persian/Arabic yeh and kaf, digits, whitespace) and exactly matched: vehicleKind/MapTypNam, vehicleSystemTitle/SystemField, UsageField/usage, and vehicleGroupTitle.
  4. Ambiguous or relationship-incompatible results remain empty and produce a warning for manual expert selection.

Legacy provider codes UsgCod, VehSysCod, and CarGrpCod are returned only under suggestion.legacyCodes for audit. They are deliberately not used as Fanavaran IDs because their numeric domains differ; for example, inquiry UsgCod=8 can mean personal use while Fanavaran's personal-use lookup ID is 1.

The panel applies the suggestion once, displays its matched-field count and raw legacy codes, leaves consent unchecked, and lets the expert replace any value before approval.

Panel endpoints

  • GET /v2/expert-claim/request/:claimRequestId/fanavaran-vehicle-options?vehicleGroupId=1 returns active groups and only the compatible use types/systems for the selected group.
  • GET /lookups/vehicle-list?q=پراید&limit=30&vehicleGroupId=1&vehicleSystemId=14 performs the bounded async vehicle-kind search.
  • PUT /v2/expert-claim/request/:claimRequestId/fanavaran-vehicle-review accepts the four IDs plus confirmed: true.

The approval endpoint re-resolves every caption server-side and rejects inactive values or a group/use/system/kind relationship mismatch. Client-supplied captions are never trusted. A successful approval resumes base-claim submission and, when selected damage parts already exist, the damage-case stage.

Outbound enforcement

Base claim, damage case, attachments, and expertise writes enforce the persisted approval. Automatic stages are deferred with a skip reason; manual stages return 409 with code FANAVARAN_VEHICLE_REVIEW_REQUIRED. Read-only previews remain available for diagnosis.

Once Fanavaran has created the base claim, the review is immutable in the panel because changing it would make the local snapshot disagree with data already written remotely.