/** Monetary values and non-property quantities use unformatted decimal strings. */ export type Decimal = string; export type RequestOptions = { signal?: AbortSignal }; export type PropertyAddress = { municipalityCode?: string; city?: string; state?: string; postalCode?: string; street?: string; number?: number; neighborhood?: string; }; export type ComparableInput = { id: string; date: string; price: number; sourceUrl: string; address: { municipalityCode: string; street: string; number: number; neighborhood: string; }; propertyType: "apartment" | "house" | "land"; areaM2: number; areaBasis: "private" | "built" | "land"; landAreaM2?: number; priceBasis: "asking" | "transaction"; }; export type PropertyInput = { externalId?: string; address?: PropertyAddress; property?: { type?: "apartment" | "house" | "land"; privateAreaM2?: number; builtAreaM2?: number; landAreaM2?: number; totalAreaM2?: number; }; priceBasis?: "asking" | "transaction"; comparables?: ComparableInput[]; }; export type RequiredField = { field: string; message: string }; export type PropertyValue = { value: number; pricePerM2: number; dispersion: { lower: number; upper: number; type: "sample_interquartile"; coverageProbability: null; } | null; }; export type PropertyResult = { requestId: string; id: string; calculatedAt: string; externalId: string | null; currency: "BRL"; method?: "municipal_reference" | "user_supplied_comparables"; referenceDate?: string; requiredFields: RequiredField[]; limitations: Array<{ code: string; message: string }>; [key: string]: unknown; } & ( | { status: "estimated"; estimate: PropertyValue; referenceDate: string } | { status: "needs_input"; estimate: null; normalizedInput: null } | { status: "insufficient_data"; estimate: null } ); export type VehicleType = "cars" | "motorcycles" | "trucks"; export type CatalogItem = { code: string; name: string }; export type VehicleCatalog = { items: CatalogItem[]; level: "brands" | "models" | "years"; model_groups?: Array; grouping_basis?: string; }; export type VehicleInput = { type: VehicleType; brand: string; model: string; year: string; }; export type VehicleResult = { status: "ESTIMATED"; amount: Decimal; currency: "BRL"; basis: string; label: string; asset: { type: VehicleType; brand: string; model: string; model_year: number | null; year_code: string; zero_km: boolean; fuel: string; fipe_code: string; [key: string]: unknown; }; source: { as_of: string; reference_month: string; [key: string]: unknown }; limitations: string[]; [key: string]: unknown; }; export type KnowledgeQuery = { asset_class: "AIRCRAFT" | "VESSEL"; brand_id?: string; model_id?: string; year?: string; configuration_id?: string; }; export type KnowledgeInput = Required; export type AssetResult = { status: | "ESTIMATED" | "SIMULATED" | "INSUFFICIENT_DATA" | "REFERENCE" | "REFERENCE_LIMITED"; amount: Decimal | null; currency: "BRL"; basis: string; [key: string]: unknown; }; export type EstimateSummary = { status: string; hasValue: boolean; amount: Decimal | null; currency: string; referenceDate: string | null; basis: string | null; requiredFields: RequiredField[]; limitations: Array; }; export class EstimaBemApiError extends Error { status: number; code: string; requestId: string | null; details: unknown; retryable: boolean; retryAfterSeconds: number | null; constructor( message: string, options?: { status?: number; code?: string; requestId?: string | null; details?: unknown; retryable?: boolean; retryAfterSeconds?: number | null; }, ); } export interface EstimaBemClient { estimatePropertyV3(input: PropertyV3Input, options?: RequestOptions): Promise; propertyCoverageV3(params?: { family?: PropertyV3Input["property"]["family"]; municipalityCode?: string }, options?: RequestOptions): Promise>; estimateProperty( input: PropertyInput, options?: RequestOptions, ): Promise; estimateNational( input: Record, options?: RequestOptions, ): Promise>; propertyCoverage( municipalityCode: string, options?: RequestOptions, ): Promise>; postalAddress( cep: string, options?: RequestOptions, ): Promise>; coverage(options?: RequestOptions): Promise>; vehicleCatalog( query: { type: VehicleType; brand?: string; model?: string }, options?: RequestOptions, ): Promise; estimateVehicle( input: VehicleInput, options?: RequestOptions, ): Promise; equipmentCatalog( family: string, options?: RequestOptions, ): Promise>; estimateEquipment( input: { family: string; product_code: string; condition: "new" | "used"; age_years?: Decimal; useful_life_years?: Decimal; residual_percent?: Decimal; }, options?: RequestOptions, ): Promise; inventoryProducts(options?: RequestOptions): Promise>; estimateInventory( input: { product_id: string; quantity: Decimal }, options?: RequestOptions, ): Promise; estimateInventoryLot( input: Record, options?: RequestOptions, ): Promise; knowledgeCatalog( query: KnowledgeQuery, options?: RequestOptions, ): Promise<{ items: CatalogItem[]; step: string; status: "AVAILABLE" | "NO_COVERAGE"; message: string; }>; estimateKnowledge( input: KnowledgeInput, options?: RequestOptions, ): Promise; treasuryCatalog(options?: RequestOptions): Promise>; estimateTreasury( input: { product_id: string; quantity: Decimal }, options?: RequestOptions, ): Promise; estimateCredit( input: { asset_class: "RECEIVABLE" | "JUDICIAL_CREDIT"; face_value: Decimal; due_date: string; }, options?: RequestOptions, ): Promise; estimateGuided( input: { asset_class: string; parameters: Record }, options?: RequestOptions, ): Promise; } export function createEstimaBemClient(options?: { baseUrl?: string; apiKey?: string; timeoutMs?: number; fetchImpl?: typeof fetch; }): EstimaBemClient; export function readEstimate( result: PropertyResult | VehicleResult | AssetResult | Record, ): EstimateSummary; // BEGIN GENERATED PROPERTY V3 — scripts/generate-property-sdk.mjs export type V3Address = { "city"?: string; "state"?: string; "municipalityCode"?: string; "postalCode"?: string; "street"?: string; "neighborhood"?: string; "complement"?: string; "condominium"?: string; "development"?: string; "lot"?: string; "block"?: string; "unit"?: string; "tower"?: string; "number"?: number | string; "district"?: string; }; export type V3Property = { "family": "residencial_apartamento" | "residencial_compacto" | "flat_residencial" | "casa" | "casa_condominio" | "lote_urbano" | "gleba_urbana" | "escritorio_pequeno" | "escritorio_grande" | "loja" | "logistica" | "industrial" | "garagem_unidade" | "estacionamento" | "edificio_residencial" | "edificio_comercial" | "misto" | "rural_produtivo" | "chacara_lazer" | "florestal" | "hotelaria" | "institucional" | "infraestrutura" | "indeterminado"; "originalLabel"?: string; "territory"?: "urban" | "rural" | "unknown"; "constructionState"?: "ready" | "under_construction" | "demolished" | "unknown"; "scope"?: "whole_property" | "interest"; "unitSql"?: string; "registryNumber"?: string; "registryOffice"?: string; "specialUse"?: string; "privateAreaM2"?: number; "builtAreaM2"?: number; "landAreaM2"?: number; "commonAreaM2"?: number; "iptuBuiltAreaM2"?: number; "lettableAreaM2"?: number; "parkingAreaM2"?: number; "parkingSpaces"?: number; "standardCode"?: number; "correctedConstructionYear"?: number; }; export type V3Source = { "url": string; "observedAt": string; "title"?: string; "sha256"?: string; "file"?: string; "sheet"?: string; "row"?: number; }; export type V3Comparable = { "id": string; "entityId": string; "buildingId"?: string; "address": V3Address; "property": V3Property; "price": number; "currency": "BRL"; "priceBasis": "asking" | "transaction"; "date": string; "source": V3Source; }; export type PropertyV3Input = { "externalId"?: string; "address": V3Address; "property": V3Property; "priceBasis"?: "auto" | "asking" | "transaction"; "comparables"?: (V3Comparable)[]; "income"?: { "netAnnualRent": number; "capitalizationRate": number; "source": V3Source; }; "cost"?: { "landValue": number; "replacementCost": number; "depreciationRate": number; "source": V3Source; }; }; export type PropertyV3Result = { apiVersion: "v3"; id: string; requestId: string; calculatedAt: string; referenceDate: string; currency: "BRL"; family: V3Property["family"]; modelVersion: string; datasetId: string; quality?: "preliminary" | "municipal_reference" | "regional_reference" | "territorial_reference" | "input_scenario"; method?: string; geographicReference?: {scope: string; label: string; targetMunicipalityCode: string | null; sourceMunicipalities: Array<{code: string; name: string; state: string}>; sourceMunicipalityCount: number; searchRadiusMeters: number | null}; limitations: Array<{code: string; message: string}>; requiredFields: RequiredField[]; [key: string]: unknown } & ({status: "estimated"; estimate: {value: number; pricePerM2?: number | null; dispersion: PropertyValue["dispersion"]}} | {status: "needs_input" | "insufficient_data" | "needs_review" | "unsupported_profile" | "processing"; estimate: null}); // END GENERATED PROPERTY V3