@horizon-modules/arbo-crm-to-property-v2
Version:
Conversor de dados do Arbo CRM para o formato Property Model V2
178 lines (169 loc) • 5.26 kB
text/typescript
interface ArboCorretor {
codigo: number;
nome: string;
telefones: string[];
}
interface ArboImobiliaria {
nome: string;
infos: Array<{
url: string;
tipo: string;
}>;
telefones: string[];
}
interface ArboProperty {
ref_id: number;
codigo: string;
codigo_origem?: string;
ativo: boolean;
publicado: boolean;
titulo: string;
descricao: string;
finalidade: string;
categoria: string;
tipo_imovel: string;
status_comercial?: string;
categoria_imovel?: string;
valor_venda?: number;
valor_aluguel?: number;
valor_condominio?: number;
valor_iptu?: number;
qtd_banheiro?: number;
qtd_quartos?: number;
qtd_suites?: number;
qtd_vagas?: number;
area_total?: number;
area_privativa?: number;
end_cep?: string;
end_estado?: string;
end_cidade?: string;
end_bairro?: string;
end_logradouro?: string;
end_numero?: number;
end_complemento?: string;
end_condominio?: string;
latitude?: number;
longitude?: number;
url_video?: string;
url_tour?: string;
caracteristicas?: string[];
mobiliado?: boolean;
permuta?: boolean;
financiamento?: boolean;
fotos?: ArboPhoto[];
corretor?: ArboCorretor;
imobiliaria?: ArboImobiliaria;
condominio?: number;
emp_fields?: Record<string, any>;
origemcadastro?: string;
prop_id?: number;
created_at?: string;
updated_at?: string;
}
interface ArboPhoto {
url: string;
ordem: number;
principal: boolean;
marcadagua_url: string;
sizes: {
medium: string;
small: string;
};
}
type AttributeType = "amount" | "bool" | "text" | "number" | "area" | "currency" | "address";
type AttributeSection = "rooms" | "feature" | "improvement" | "location" | "local" | "legal";
interface PropertyV2Attribute {
key: string;
ref?: string;
type?: AttributeType;
label?: string;
value: any;
section?: AttributeSection;
tags?: string[];
"value.label"?: string;
}
interface PropertyV2Media {
videos: any[];
tour360: any[];
pictures: PropertyV2Picture[];
}
interface PropertyV2Picture {
id: string;
src: string;
name: string;
label: string;
}
interface PropertyV2Search {
id: number;
title: string;
reference: string;
type: string;
subtype: string;
operation: string;
price: number;
tags: string;
keywords: string;
description: string;
highlighted_date: string | null;
state: string | null;
city: string;
district: string;
lat: number;
lon: number;
created_at: string;
modified_at: string | null;
updated_at: string | null;
bed: number;
bath: number;
garage: number;
area: number;
}
interface PropertyV2 {
id: number;
source_id: number | null;
reference: string;
title: string;
description: string;
type: string;
subtype: string;
operation: string;
attributes: PropertyV2Attribute[];
media: PropertyV2Media;
tags: string;
keywords: string;
thumbnails: string;
web_code: string | null;
provider: string;
index: number | null;
seo: any | null;
visibility: any | null;
preview: any | null;
created_at: string;
modified_at: string;
updated_at: string;
property_search: PropertyV2Search[];
}
interface ConversionOptions {
agentId?: string;
clientId?: string;
defaultThumbnail?: string;
generateKeywords?: boolean;
generateTags?: boolean;
}
declare function convertArboToPropertyV2(arbo: ArboProperty, options?: ConversionOptions): PropertyV2;
declare function convertMultipleArboToPropertyV2(arboProperties: ArboProperty[], options?: ConversionOptions): PropertyV2[];
declare function discoverType(arbo: ArboProperty): {
type: string;
subtype: string;
};
declare function discoverOperation(arbo: ArboProperty): string;
declare function discoverAttributes(arbo: ArboProperty, operation: string, type: string, subtype: string, options?: {
agentId?: string;
clientId?: string;
}): PropertyV2Attribute[];
declare function discoverMedia(arbo: ArboProperty): PropertyV2Media;
declare function discoverThumbnails(arbo: ArboProperty, media: PropertyV2Media): string;
declare function discoverTags(arbo: ArboProperty, attributes: PropertyV2Attribute[], operation: string): string;
declare function discoverKeywords(arbo: ArboProperty, attributes: PropertyV2Attribute[]): string;
declare function discoverPropertySearch(arbo: ArboProperty, id: number, title: string, reference: string, type: string, subtype: string, operation: string, price: number, tags: string, keywords: string, description: string, attributes: PropertyV2Attribute[]): PropertyV2Search;
export { type ArboCorretor, type ArboImobiliaria, type ArboPhoto, type ArboProperty, type AttributeSection, type AttributeType, type ConversionOptions, type PropertyV2, type PropertyV2Attribute, type PropertyV2Media, type PropertyV2Picture, type PropertyV2Search, convertArboToPropertyV2, convertMultipleArboToPropertyV2, discoverAttributes, discoverKeywords, discoverMedia, discoverOperation, discoverPropertySearch, discoverTags, discoverThumbnails, discoverType };