# Grower Guide

Complete workflow guide for growers using LocalGreenChain.

## Getting Started as a Grower

### 1. Register Your Account

Navigate to the registration page and create your grower profile:

```typescript
// Grower profile includes
{
  id: "grower-uuid",
  name: "Green Valley Farm",
  location: {
    latitude: 40.7128,
    longitude: -74.0060,
    city: "Brooklyn",
    region: "New York"
  },
  capacity: {
    outdoorSqMeters: 500,
    greenhouseSqMeters: 200,
    verticalFarmSqMeters: 0
  },
  certifications: ["organic", "local"]
}
```

### 2. Set Up Your Growing Locations

Register each growing location:

- Outdoor plots
- Greenhouses
- Indoor growing areas
- Vertical farm zones (if applicable)

## Plant Registration Workflow

### Register Seeds

When you receive or save seeds, create a seed acquisition record:

```typescript
// Example: Register seed acquisition
POST /api/transport/seed-acquisition

{
  seedBatchId: "seeds-tomato-2024-001",
  sourceType: "purchase",  // or "previous_harvest", "trade", "gift"
  species: "Solanum lycopersicum",
  variety: "Cherokee Purple",
  quantity: 500,
  quantityUnit: "seeds",
  generation: 1,
  certifications: ["organic", "heirloom"],
  fromLocation: {
    latitude: 38.9072,
    longitude: -77.0369,
    locationType: "seed_bank",
    facilityName: "Heritage Seed Company"
  },
  toLocation: {
    latitude: 40.7128,
    longitude: -74.0060,
    locationType: "farm",
    facilityName: "Green Valley Farm"
  }
}
```

### Record Planting

When you plant seeds:

```typescript
// Example: Record planting event
POST /api/transport/planting

{
  seedBatchId: "seeds-tomato-2024-001",
  plantIds: ["plant-001", "plant-002", ...],  // Auto-generated
  plantingMethod: "transplant",
  quantityPlanted: 50,
  growingEnvironment: "greenhouse",
  expectedHarvestDate: "2024-08-15",
  fromLocation: { ... },  // Seed storage
  toLocation: { ... }     // Planting location
}
```

### Track Growing Transport

If you move plants (transplanting, hardening off):

```typescript
POST /api/transport/growing

{
  plantIds: ["plant-001", "plant-002"],
  reason: "transplant",
  plantStage: "seedling",
  handlingMethod: "potted",
  rootDisturbance: "minimal"
}
```

## Responding to Demand Signals

### View Regional Demand

Check what consumers in your area need:

```typescript
GET /api/demand/signal?lat=40.7128&lon=-74.0060&radius=50
```

Response shows demand gaps:

```json
{
  "demandItems": [
    {
      "produceType": "tomato",
      "weeklyDemandKg": 180,
      "gapKg": 120,
      "aggregatePriority": 8,
      "urgency": "this_week"
    }
  ],
  "supplyStatus": "shortage"
}
```

### Get Planting Recommendations

```typescript
GET /api/demand/recommendations?
  growerId=your-id&
  lat=40.7128&
  lon=-74.0060&
  availableSpaceSqm=100&
  season=summer
```

Response includes actionable recommendations:

```json
{
  "recommendations": [
    {
      "produceType": "tomato",
      "recommendedQuantity": 50,
      "expectedYieldKg": 400,
      "projectedRevenue": 1800,
      "plantByDate": "2024-05-15",
      "overallRisk": "low",
      "explanation": "Strong local demand with 120kg weekly gap..."
    }
  ]
}
```

### Commit Supply

Register your planned production:

```typescript
POST /api/demand/supply

{
  produceType: "tomato",
  variety: "Cherokee Purple",
  committedQuantityKg: 400,
  availableFrom: "2024-08-01",
  availableUntil: "2024-09-30",
  pricePerKg: 4.50,
  certifications: ["organic"],
  deliveryRadiusKm: 50,
  deliveryMethods: ["grower_delivery", "farmers_market"]
}
```

## Harvesting and Distribution

### Record Harvest

```typescript
POST /api/transport/harvest

{
  plantIds: ["plant-001", "plant-002", ...],
  harvestBatchId: "harvest-tomato-2024-001",
  harvestType: "partial",  // or "full", "continuous"
  produceType: "tomatoes",
  grossWeight: 45,
  netWeight: 42,
  weightUnit: "kg",
  qualityGrade: "A",
  shelfLifeHours: 168,
  seedsSaved: true,
  seedBatchIdCreated: "seeds-tomato-2024-002"
}
```

### Distribute to Consumers

```typescript
POST /api/transport/distribution

{
  batchIds: ["harvest-tomato-2024-001"],
  destinationType: "consumer",
  orderId: "order-123",
  customerType: "individual",
  deliveryWindow: {
    start: "2024-08-01T09:00:00Z",
    end: "2024-08-01T12:00:00Z"
  },
  transportMethod: "electric_vehicle"
}
```

## Seed Saving

### Complete the Cycle

Save seeds for next generation:

```typescript
POST /api/transport/seed-saving

{
  parentPlantIds: ["plant-001", "plant-005", "plant-012"],
  newSeedBatchId: "seeds-tomato-2024-002",
  collectionMethod: "wet_seed",
  seedCount: 250,
  germinationRate: 92,
  storageConditions: {
    temperature: 4,
    humidity: 30,
    lightExposure: "dark",
    containerType: "vacuum_sealed",
    desiccant: true,
    estimatedViability: 5
  },
  newGenerationNumber: 2,
  availableForSharing: true,
  sharingTerms: "trade"
}
```

### Share Seeds

Connect with other growers:

```typescript
POST /api/transport/seed-sharing

{
  seedBatchId: "seeds-tomato-2024-002",
  quantityShared: 50,
  quantityUnit: "seeds",
  sharingType: "trade",
  tradeDetails: "Exchanged for 25 seeds of Brandywine",
  recipientAgreement: true,
  reportBackRequired: true
}
```

## Analytics and Optimization

### View Your Environmental Impact

```typescript
GET /api/transport/footprint/your-user-id
```

Response:

```json
{
  "totalCarbonKg": 12.5,
  "totalFoodMiles": 245,
  "carbonPerKgProduce": 0.15,
  "comparisonToConventional": {
    "carbonSaved": 187.5,
    "milesSaved": 14755,
    "percentageReduction": 94
  }
}
```

### Track Plant Journeys

```typescript
GET /api/transport/journey/plant-001
```

## Best Practices

### For Maximum Impact

1. **Register Seeds Promptly** - Log as soon as you receive them
2. **Track All Movements** - Every transplant, every harvest
3. **Save Quality Seeds** - Maintain genetic diversity
4. **Respond to Demand** - Check signals weekly
5. **Commit Supply Early** - Pre-selling reduces waste

### For Quality

1. **Record Environmental Data** - Helps future planning
2. **Grade Honestly** - Build consumer trust
3. **Meet Delivery Windows** - Reliability matters
4. **Handle Gently** - Minimize transport damage

### For Community

1. **Share Seeds** - Especially rare varieties
2. **Report Results** - Help improve recommendations
3. **Connect Locally** - Build grower networks
4. **Teach Others** - Expand the ecosystem

## Data Flow Diagram

```
┌─────────────────────────────────────────────────────────────┐
│                      GROWER WORKFLOW                         │
├─────────────────────────────────────────────────────────────┤
│                                                               │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐               │
│  │  SEEDS   │───→│  PLANT   │───→│   GROW   │               │
│  │ Acquire  │    │          │    │Transport │               │
│  └──────────┘    └──────────┘    └──────────┘               │
│       ↑                                │                      │
│       │                                ▼                      │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐               │
│  │ SAVE OR  │←───│ HARVEST  │←───│  MATURE  │               │
│  │  SHARE   │    │          │    │          │               │
│  └──────────┘    └──────────┘    └──────────┘               │
│       │                │                                      │
│       │                ▼                                      │
│       │         ┌──────────┐    ┌──────────┐                │
│       │         │DISTRIBUTE│───→│ CONSUMER │                │
│       │         │          │    │ DELIVERY │                │
│       │         └──────────┘    └──────────┘                │
│       │                                                       │
│       └──────────→ Next Generation Begins                    │
│                                                               │
└─────────────────────────────────────────────────────────────┘
```

## Next Steps

- [Transport Guide](./transport-guide.md) - Detailed transport tracking
- [Vertical Farm Guide](./vertical-farm-guide.md) - Indoor growing
- [Consumer Guide](./consumer-guide.md) - Understand your customers
