import { Task } from "@/server/task/domain/models";
export const typeCotizationEnum = ["pa", "metro",'otro'] as const;
export type TypeCotization = (typeof typeCotizationEnum)[number];
export const typeEnum = ["apartamento", "casa",'otro'] as const;
export type Type = (typeof typeEnum)[number];
type DateRangeOption =
| "today"
| "thismonth"
| "last3months"
| "thisyear"
| "all";
export interface ProjectId {
value: string;
}
export const projectStatusEnum = [
"no iniciada",
"en proceso",
"completada",
"cancelada",
"reabierta",
] as const;
export type ProjectStatus = (typeof projectStatusEnum)[number];
export interface ProjectFilter {
range?: DateRangeOption;
status?: ProjectStatus;
searchQuery?: string;
page?: number;
limit?: number;
includeTasks?: boolean;
includeFloor?:boolean
includeAreas?:boolean
}
export interface Project {
id: string;
name: string;
residence: Type;
costPerMeter?: number;
totalCostPerMeter?: number;
totalCostMaterials?: number;
laborCost?: number;
startDate: Date;
typeCotization: TypeCotization;
estimatedEndDate?: Date | undefined;
status?: ProjectStatus;
createdAT?: Date;
updatedAt?: Date;
}
export interface ProjectQueryItem {
id: string;
name: string;
totalCostMaterials: number;
totalCostPerMeter: number;
laborCost: number;
residence: string;
status: string;
floor: {
id: string;
name: string;
areas: {
id: string;
type: string;
floorId: string;
}[]
}[];
updatedAt: Date | null;
tasks?: Task[];
}
export interface ProjectQueryResuls {
projects: ProjectQueryItem[];
pageCount: number;
results: number;
}
export interface ProjectDetail {
id: string;
name: string;
residence:string;
status:ProjectStatus;
costPerMeter:number;
totalCostMaterials:number;
totalCostPerMeter:number
laborCost:number;
floor: {
id: string;
name: string;
areas: {
id: string;
type: string;
status:AreaStatusEnum
width:number;
length:number;
quantity:number
}[];
}[];
projectMaterials: {
id: string;
requiredQuantity: number;
usedQuantity: number;
availableQuantity: number;
materials: {
id: string;
name: string;
price: number;
};
}[];
task: Task[];
}
export interface ProjectMaterials {
id: string;
name: string;
projectMaterials: {
id: string;
requiredQuantity: number;
usedQuantity: number;
availableQuantity: number;
materials: {
id: string;
name: string;
};
project: {
id: string;
name: string;
};
}[];
}
export interface ProjectSummary {
status: "completada" | "en proceso" | "no iniciada";
count: number;
label: string;
}
export interface ProjectEarnings {
name: string;
residence: "apartamento" | "casa";
month: number;
total: number;
}
export interface ProjectEarningsResults {
projectsEarnings: ProjectEarnings[];
projectsAnalitics: { month: string; total: number }[];
totalEarnings: number;
}
export interface Floor {
id: string;
name: string;
projectName: string;
projectId: string;
}
export interface FloorId {
value: string;
}
export const areaStatusEnum = [
"no iniciada",
"en proceso",
"completada",
"revisada",
"cancelada",
"reabierta",
] as const;
export type AreaStatusEnum = (typeof areaStatusEnum)[number];
export interface AreaId {
value: string;
}
export interface Area {
id: string;
type: string;
length: number;
width: number;
quantity: number;
floorId: string;
projectName: string;
projectId: string;
status: AreaStatusEnum;
}