Files
ocean-cleanup/src/types/index.ts
2025-11-16 16:00:51 +00:00

122 lines
2.6 KiB
TypeScript

// Core type definitions for the Beach Litter Mapping Platform
export type LitterType = 'plastic' | 'metal' | 'glass' | 'organic' | 'hazardous' | 'other';
export type QuantityLevel = 'minimal' | 'moderate' | 'significant' | 'severe';
export type LocationSource = 'exif' | 'gps' | 'manual';
export type VerificationStatus = 'pending' | 'verified' | 'disputed';
export type EventStatus = 'upcoming' | 'completed' | 'cancelled';
export interface Coordinates {
latitude: number;
longitude: number;
}
export interface User {
id: string;
clerkId: string;
email: string;
username: string;
firstName?: string;
lastName?: string;
avatarUrl?: string;
impactScore: number;
createdAt: Date;
updatedAt: Date;
}
export interface Report {
id: string;
userId: string;
latitude: number;
longitude: number;
locationSource: LocationSource;
photoUrls: string[];
photoTimestamp?: Date;
litterType: LitterType;
quantity: QuantityLevel;
description?: string;
createdAt: Date;
updatedAt: Date;
submittedAt: Date;
verificationStatus: VerificationStatus;
}
export interface CleanupEvent {
id: string;
organizerId: string;
title: string;
description: string;
latitude: number;
longitude: number;
locationName: string;
scheduledDate: Date;
duration: number; // in minutes
status: EventStatus;
participantCount: number;
litterCollected?: number; // in kilograms
photos?: string[];
createdAt: Date;
updatedAt: Date;
}
export interface EnvironmentalConcern {
id: string;
reportId: string;
concernType: string;
severity: 'low' | 'medium' | 'high' | 'critical';
description: string;
createdAt: Date;
}
export interface Hotspot {
id: string;
latitude: number;
longitude: number;
radius: number; // in meters
reportCount: number;
severityScore: number;
lastReportDate: Date;
calculatedAt: Date;
}
// DTOs (Data Transfer Objects)
export interface CreateReportDTO {
photos: File[];
latitude?: number;
longitude?: number;
locationSource: LocationSource;
litterType: LitterType;
quantity: QuantityLevel;
description?: string;
environmentalConcerns?: {
type: string;
severity: 'low' | 'medium' | 'high' | 'critical';
description: string;
}[];
}
export interface ReportResponseDTO extends Report {
user: {
id: string;
username: string;
avatarUrl?: string;
};
verificationCount: number;
disputeCount: number;
environmentalConcerns: EnvironmentalConcern[];
}
export interface FilterState {
dateRange?: {
start: Date;
end: Date;
};
litterTypes?: LitterType[];
quantities?: QuantityLevel[];
verificationStatus?: VerificationStatus[];
}