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 type CertificationStatus = | 'standard 2020' | 'standard 2023' | 'nonstandard' | 'in progress'; export interface OffsetProject { id: string; name: string; description: string; shortDescription: string; imageUrl: string; pricePerTon: number; percentage?: number; // Project's contribution to portfolio certificationStatus?: CertificationStatus; // Wren certification standard location: string; type: string; verificationStandard: string; impactMetrics: { co2Reduced: number; treesPlanted?: number; livelihoodsImproved?: number; }; } export type OffsetOrderSource = | 'subscription' | 'flight' | 'gift' | 'custom-duration' | 'one-off' | 'referral-bonus' | 'annual-incentive' | 'public-api' | 'special-offer'; export interface OffsetOrder { id: string; amountCharged: number; // Amount in cents (amount_paid_by_customer from API) currency: CurrencyCode; tons: number; portfolio: Portfolio; status: 'pending' | 'completed' | 'failed'; createdAt: string; dryRun: boolean; source?: OffsetOrderSource; // Source of the payment note?: string; // Optional note attached to the order } export type CalculatorType = 'trip' | 'annual'; // Stripe Checkout Types export interface CheckoutSession { sessionId: string; url: string; orderId: string; } export interface StoredOrder { id: string; stripeSessionId: string; stripePaymentIntent: string | null; wrenOrderId: string | null; customerEmail: string | null; tons: number; portfolioId: number; baseAmount: number; // in cents processingFee: number; // in cents totalAmount: number; // in cents currency: CurrencyCode; status: 'pending' | 'paid' | 'fulfilled' | 'failed'; createdAt: string; updatedAt: string; } export interface OrderDetailsResponse { order: { id: string; tons: number; portfolioId: number; baseAmount: number; processingFee: number; totalAmount: number; currency: string; status: string; wrenOrderId: string | null; createdAt: string; }; session: { paymentStatus: string; customerEmail?: string; }; }