puffin-app/src/types.ts

80 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-05-13 18:50:30 +02:00
export interface VesselData {
imo: string;
vesselName: string;
type: string;
length: number;
width: number;
estimatedEnginePower: number;
}
export interface CarbonCalculation {
yearlyEmissions: number;
offsetCost: number;
recommendedProjects: Array<{
id: string;
name: string;
description: string;
costPerTon: number;
}>;
}
export interface CarbonEstimate {
fuelConsumption: number; // liters per year
co2Emissions: number; // tons per year
}
export interface TripEstimate {
distance: number; // nautical miles
duration: number; // hours
fuelConsumption: number; // liters
co2Emissions: number; // tons
}
export interface Currency {
code: string;
symbol: string;
rate: number; // Exchange rate relative to USD
}
export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'CHF';
export interface Portfolio {
id: number;
name: string;
description: string;
projects: OffsetProject[];
pricePerTon: number;
currency: CurrencyCode;
}
export interface OffsetProject {
id: string;
name: string;
description: string;
shortDescription: string;
imageUrl: string;
pricePerTon: number;
2025-05-13 20:58:17 +02:00
percentage?: number; // Added percentage field for project's contribution to portfolio
2025-05-13 18:50:30 +02:00
location: string;
type: string;
verificationStandard: string;
impactMetrics: {
co2Reduced: number;
treesPlanted?: number;
livelihoodsImproved?: number;
};
}
export interface OffsetOrder {
id: string;
amountCharged: number; // Amount in cents
currency: CurrencyCode;
tons: number;
portfolio: Portfolio;
status: 'pending' | 'completed' | 'failed';
createdAt: string;
dryRun: boolean;
}
2025-05-13 20:58:17 +02:00
export type CalculatorType = 'trip' | 'annual';