feat: add budget domain types and partida labels
This commit is contained in:
23
mvp/b2c/src/budget/labels.ts
Normal file
23
mvp/b2c/src/budget/labels.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import type { PartidaKey } from './types';
|
||||||
|
|
||||||
|
export const PARTIDA_ORDER: PartidaKey[] = [
|
||||||
|
'demolicion',
|
||||||
|
'alicatado',
|
||||||
|
'fontaneria',
|
||||||
|
'electricidad',
|
||||||
|
'carpinteria',
|
||||||
|
'mano_de_obra',
|
||||||
|
'extras',
|
||||||
|
'licencia',
|
||||||
|
];
|
||||||
|
|
||||||
|
export const PARTIDA_LABEL: Record<PartidaKey, string> = {
|
||||||
|
demolicion: 'Demolición',
|
||||||
|
alicatado: 'Alicatado y solado',
|
||||||
|
fontaneria: 'Fontanería',
|
||||||
|
electricidad: 'Electricidad',
|
||||||
|
carpinteria: 'Carpintería y mobiliario',
|
||||||
|
mano_de_obra: 'Mano de obra',
|
||||||
|
extras: 'Pintura y extras',
|
||||||
|
licencia: 'Licencia + Proyecto técnico',
|
||||||
|
};
|
||||||
61
mvp/b2c/src/budget/types.ts
Normal file
61
mvp/b2c/src/budget/types.ts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
export type Calidad = 'basica' | 'media' | 'premium';
|
||||||
|
export type Unidad = 'm2' | 'ml' | 'ud';
|
||||||
|
export type CategoriaMaterial = 'suelo' | 'pared' | 'pintura' | 'mobiliario';
|
||||||
|
export type TipoReforma = 'cocina' | 'bano' | 'salon' | 'comedor' | 'integral' | 'otro';
|
||||||
|
|
||||||
|
export type PartidaKey =
|
||||||
|
| 'demolicion'
|
||||||
|
| 'alicatado'
|
||||||
|
| 'fontaneria'
|
||||||
|
| 'electricidad'
|
||||||
|
| 'carpinteria'
|
||||||
|
| 'mano_de_obra'
|
||||||
|
| 'extras'
|
||||||
|
| 'licencia';
|
||||||
|
|
||||||
|
export type ManoObraKey = 'demolicion' | 'fontaneria' | 'electricidad' | 'mano_de_obra';
|
||||||
|
|
||||||
|
export interface CatalogItem {
|
||||||
|
id: string;
|
||||||
|
categoria: CategoriaMaterial;
|
||||||
|
nombre: string;
|
||||||
|
calidad: Calidad;
|
||||||
|
precioUnit: number; // céntimos por unidad
|
||||||
|
unidad: Unidad;
|
||||||
|
descriptorRender: string;
|
||||||
|
esDefault: boolean;
|
||||||
|
sku: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PricingConfig {
|
||||||
|
alturaTechoDefault: number; // metros
|
||||||
|
factorZona: Record<string, number>; // provincia -> multiplicador
|
||||||
|
manoObra: Record<ManoObraKey, number>; // céntimos por m² de suelo
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BudgetInputs {
|
||||||
|
tipoReforma: TipoReforma;
|
||||||
|
m2Suelo: number | null;
|
||||||
|
alturaTecho: number | null;
|
||||||
|
calidadGlobal: Calidad;
|
||||||
|
estructural: boolean;
|
||||||
|
provincia: string | null;
|
||||||
|
materialSelections: Partial<Record<CategoriaMaterial, string>>; // categoria -> catalogItemId
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartidaResult {
|
||||||
|
key: PartidaKey;
|
||||||
|
label: string;
|
||||||
|
importe: number; // céntimos (base, antes de factor zona)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BudgetResult {
|
||||||
|
partidas: PartidaResult[];
|
||||||
|
subtotal: number; // céntimos
|
||||||
|
factorZona: number;
|
||||||
|
total: number; // céntimos = round(subtotal * factorZona)
|
||||||
|
rango: { min: number; max: number }; // céntimos
|
||||||
|
confianza: 'baja' | 'media' | 'alta';
|
||||||
|
materialesRender: string[]; // descriptores para el prompt del render
|
||||||
|
avisos: string[];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user