localgreenchain/lib/blockchain/types.ts
Claude 507df5912f
Deploy GrowerAdvisoryAgent (Agent 10) and fix type errors
- Add GrowerAdvisoryAgent test file
- Fix PlantChain constructor initialization order (plantIndex before genesis block)
- Fix blockchain.getChain() calls to use blockchain.chain property
- Add PropagationType export to blockchain types
- Fix SoilComposition.type property references (was soilType)
- Fix ClimateConditions.temperatureDay property references (was avgTemperature)
- Fix ClimateConditions.humidityAverage property references (was avgHumidity)
- Fix LightingConditions.naturalLight.hoursPerDay nested access
- Add 'critical' severity to QualityReport issues
- Add 'sqm' unit to PlantingRecommendation.quantityUnit
- Fix GrowerAdvisoryAgent growthMetrics property access
- Update TypeScript to v5 for react-hook-form compatibility
- Enable downlevelIteration in tsconfig for Map iteration
- Fix crypto Buffer type issues in anonymity.ts
- Fix zones.tsx status type comparison
- Fix next.config.js images.domains filter
- Rename [[...slug]].tsx to [...slug].tsx to resolve routing conflict
2025-11-23 00:44:58 +00:00

96 lines
2.2 KiB
TypeScript

// Plant Blockchain Types
import { GrowingEnvironment, GrowthMetrics } from '../environment/types';
// Re-export types from environment
export type { GrowingEnvironment, GrowthMetrics };
// Re-export PlantBlock class
export { PlantBlock } from './PlantBlock';
// Propagation type alias
export type PropagationType = 'seed' | 'clone' | 'cutting' | 'division' | 'grafting' | 'original';
export interface PlantLocation {
latitude: number;
longitude: number;
address?: string;
city?: string;
country?: string;
}
export interface PlantOwner {
id: string;
name: string;
email: string;
walletAddress?: string;
}
export interface PlantData {
id: string;
commonName: string;
scientificName?: string;
species?: string;
genus?: string;
family?: string;
// Lineage tracking
parentPlantId?: string; // Original plant this came from
propagationType?: 'seed' | 'clone' | 'cutting' | 'division' | 'grafting' | 'original';
generation: number; // How many generations from the original
// Plant lifecycle
plantedDate: string;
harvestedDate?: string;
status: 'sprouted' | 'growing' | 'mature' | 'flowering' | 'fruiting' | 'dormant' | 'deceased';
// Location and ownership
location: PlantLocation;
owner: PlantOwner;
// Plant network
childPlants: string[]; // IDs of clones and seeds from this plant
// Environmental data
environment?: GrowingEnvironment;
growthMetrics?: GrowthMetrics;
// Additional metadata
notes?: string;
images?: string[];
plantsNetId?: string; // ID from plants.net API
// Timestamps
registeredAt: string;
updatedAt: string;
}
export interface BlockData {
index: number;
timestamp: string;
plant: PlantData;
previousHash: string;
hash: string;
nonce: number;
}
export interface PlantLineage {
plantId: string;
ancestors: PlantData[];
descendants: PlantData[];
siblings: PlantData[]; // Other plants from the same parent
generation: number;
}
export interface NearbyPlant {
plant: PlantData;
distance: number; // in kilometers
owner: PlantOwner;
}
export interface PlantNetwork {
totalPlants: number;
totalOwners: number;
species: { [key: string]: number };
globalDistribution: { [country: string]: number };
}