import type * as schema from "@/lib/db/schema" // ── Table row types (inferred from the Drizzle schema) ─────────── export type Profile = typeof schema.profiles.$inferSelect export type Property = typeof schema.properties.$inferSelect export type Unit = typeof schema.units.$inferSelect export type Tenant = typeof schema.tenants.$inferSelect export type RentPayment = typeof schema.rent_payments.$inferSelect export type MaintenanceRequest = typeof schema.maintenance_requests.$inferSelect export type Lease = typeof schema.leases.$inferSelect export type Expense = typeof schema.expenses.$inferSelect export type Document = typeof schema.documents.$inferSelect export type Notification = typeof schema.notifications.$inferSelect export type UsageEvent = typeof schema.usage_events.$inferSelect export type Vendor = typeof schema.vendors.$inferSelect export type Inspection = typeof schema.inspections.$inferSelect // ── Insert types ───────────────────────────────────────────────── export type PropertyInsert = typeof schema.properties.$inferInsert export type UnitInsert = typeof schema.units.$inferInsert export type TenantInsert = typeof schema.tenants.$inferInsert export type RentPaymentInsert = typeof schema.rent_payments.$inferInsert export type MaintenanceRequestInsert = typeof schema.maintenance_requests.$inferInsert export type LeaseInsert = typeof schema.leases.$inferInsert export type ExpenseInsert = typeof schema.expenses.$inferInsert export type DocumentInsert = typeof schema.documents.$inferInsert // ── Plan types ─────────────────────────────────────────────────── export type Plan = "starter" | "pro" | "landlord" | "lifetime" export interface PlanLimits { maxProperties: number maxTenants: number maxAiCalls: number maxStorageMB: number hasTeamAccess: boolean hasWhiteLabel: boolean } // ── UI types ───────────────────────────────────────────────────── export interface DashboardStats { totalProperties: number totalUnits: number occupiedUnits: number vacantUnits: number occupancyRate: number rentCollectedThisMonth: number rentCollectedLastMonth: number rentPendingThisMonth: number rentOverdue: number openMaintenanceRequests: number expiringLeases: number // within 60 days } export interface PropertyWithUnits extends Property { units: Unit[] occupiedCount: number vacantCount: number } export interface TenantWithDetails extends Tenant { unit?: Unit | null property?: Property | null latestLease?: Lease | null latestPayment?: RentPayment | null } export interface RentPaymentWithTenant extends RentPayment { tenant: Tenant property: Property unit?: Unit | null } export interface MaintenanceWithDetails extends MaintenanceRequest { tenant?: Tenant | null property: Property unit?: Unit | null } export interface NavItem { label: string href: string icon: string }