Server-Side Services
Relevant source files
The following files were used as context for generating this wiki page:
The server-side services in the src/lib/ directory provide a suite of modular, backend-focused functionalities that support the main VineSight application. These services are encapsulated in classes and are responsible for handling tasks such as data exporting, API security, and a range of planned advanced AI-driven features. They are designed to be independent modules that can be invoked by API routes or other server-side components.
The current implementation includes a robust ExportService for generating user reports and a SecurityService for safeguarding API endpoints. The project roadmap outlines a significant expansion of these services to include a sophisticated AI-powered backend, with modules for personalization, predictive task generation, pest and disease alerts, profitability analysis, and market intelligence.
Sources: AGENTS.md, CLAUDE.md, src/lib/export-service.ts, src/lib/security-service.ts
Export Service
The ExportService is responsible for generating and downloading farm data reports in various formats. It gathers data from the Supabase backend, formats it, and provides it to the user as a CSV or PDF file.
Sources: src/lib/export-service.ts, src/app/reports/page.tsx
Architecture and Flow
The service is implemented as a static class ExportService, which means it can be used without instantiation. The primary entry point is the exportData method.
The following diagram illustrates the data flow when a user requests a data export.
This flowchart shows the process from a user's export request on the reports page to the final file download, highlighting the key methods within ExportService.
Sources: src/lib/export-service.ts:50-57, src/app/reports/page.tsx:320-353
Key Components
ExportOptions Interface
This interface defines the configuration for an export request.
| Property | Type | Description |
|---|---|---|
farmId | number | The ID of the farm to export data for. |
dateRange | { from: string; to: string; } | The start and end dates for the data query. |
includeTypes | string[] | An array of data types to include (e.g., 'irrigation', 'spray'). |
format | 'csv' | 'pdf' | The desired output format. |
reportType | 'operations' | 'financial' | ... | The type of report to generate, which influences the included data sections. |
Sources: src/lib/export-service.ts:18-27
exportData(options: ExportOptions)
This is the main static method that orchestrates the export process. It calls gatherExportData to fetch the necessary information and then routes the result to either exportToCSV or exportToPDF based on the specified format.
Sources: src/lib/export-service.ts:50-57
gatherExportData(options: ExportOptions)
This private method is responsible for fetching all required data from SupabaseService. It retrieves farm details and then conditionally fetches records for irrigation, spray, harvest, expenses, and more, based on the includeTypes option. All retrieved records are then filtered by the provided dateRange.
Sources: src/lib/export-service.ts:62-115
PDF and CSV Generation
exportToPDF(data: ExportData, options: ExportOptions): Uses thejspdfandjspdf-autotablelibraries to construct a professional PDF report. It includes a header, farm summary, and tables for different data types. The method dynamically adds pages as needed.exportToCSV(data: ExportData, options: ExportOptions): Constructs a CSV string by iterating through the gathered data. It adds headers for each data type and formats the rows accordingly.
Sources: src/lib/export-service.ts:159-224, src/lib/export-service.ts:229-354
Security Service
The SecurityService provides a centralized set of tools for securing API routes. It is implemented as a static class to offer utility methods for request validation and response generation.
*Sources: src/lib/security-service.ts
API Request Validation
The checkAPIRequest method is a comprehensive security middleware for API routes. It performs a series of checks based on the provided options.
This flowchart details the validation steps performed by the checkAPIRequest method.
Sources: src/lib/security-service.ts:13-86
checkAPIRequest Options
| Option | Type | Default | Description |
|---|---|---|---|
requireAuth | boolean | false | If true, checks for an authorization header. |
allowedMethods | string[] | ['GET', 'POST', ...] | List of allowed HTTP methods. |
maxPayloadSize | number | 10000 | (Note: This is a placeholder in the method signature, payload size is checked in validatePayload). |
requireCSRF | boolean | false | If true, validates x-csrf-token against x-session-csrf header. |
Sources: src/lib/security-service.ts:15-24
Payload Validation
The validatePayload method securely reads and parses the JSON body of a request. It checks for:
- Payload Size: Ensures the request body does not exceed a maximum size.
- Suspicious Content: Scans the raw text for common attack patterns like
<script>tags, SQL injection keywords, and template injection syntax. - Prototype Pollution: Recursively checks the parsed JSON object for keys like
__proto__orconstructorto prevent prototype pollution attacks.
Sources: src/lib/security-service.ts:91-137
Secure Responses
The service includes helper methods to generate standardized and secure JSON responses:
createErrorResponse(message, status): Creates a JSON error response with secure headers.createSuccessResponse(data, status): Creates a JSON success response with secure headers.getSecureHeaders(): Returns a set of security-hardening HTTP headers likeX-Content-Type-Options,X-Frame-Options, andReferrer-Policy.
Sources: src/lib/security-service.ts:189-215
Planned AI Services (Phase 3)
The project documentation outlines a significant expansion with a suite of advanced AI-driven services. These services are planned for Phase 3 of development and will transform VineSight from a reactive tool into a proactive AI advisor.
Sources: CLAUDE.md, context/todos.md, context/TYPES_AND_INTERFACES.md
AI Service Architecture
The planned architecture consists of several interconnected services that manage different aspects of AI-driven farm intelligence.
This diagram shows the planned relationships between the future AI services and their data sources.
Sources: CLAUDE.md
Service Responsibilities
| Service File (Planned) | Responsibility | Status |
|---|---|---|
ai-profile-service.ts | Manages farmer AI profiles, tracks decision patterns, and personalizes recommendations. | In Progress |
smart-task-generator.ts | Generates personalized task recommendations (e.g., irrigation, spraying) based on weather and farm data. | In Progress |
pest-prediction-service.ts | Provides weather-based pest/disease risk modeling and early warning notifications. | In Progress |
profitability-analysis.ts | Analyzes expenses, calculates ROI, and identifies cost optimization opportunities. | In Progress |
market-intelligence.ts | Delivers price prediction, market trend analysis, and optimal selling window recommendations. | Planned |
EnhancedAIAssistant.tsx | Integrates all AI services into a conversational interface with long-term memory. | Planned |
Sources: CLAUDE.md, context/todos.md
Key Data Structures
The AI services will rely on a set of advanced TypeScript interfaces to model complex data.
An example is the AITaskRecommendation interface, which represents a task suggested by the AI.
// Smart Task Recommendation
export interface AITaskRecommendation {
id: string;
farmId: number;
userId:string;
taskType: 'irrigation' | 'spray' | 'harvest' | 'fertigation' | 'pruning' | 'soil_test';
recommendedDate: Date;
priorityScore: number; // 0-1
weatherDependent: boolean;
reasoning: string; // AI explanation
confidenceScore: number; // 0-1
status: 'pending' | 'accepted' | 'rejected' | 'completed';
farmerFeedback?: string;
outcomeTracked: boolean;
createdAt: Date;
}
Sources: context/TYPES_AND_INTERFACES.md:120-138
Conclusion
The server-side services of VineSight form a critical layer of the application's architecture. The currently implemented ExportService and SecurityService provide essential data handling and protection capabilities. The detailed roadmap for Phase 3 AI services demonstrates a clear vision for evolving the application into an intelligent, proactive farming companion. This modular, service-oriented approach allows for scalable development and the integration of complex, data-driven features.
Sources: AGENTS.md, CLAUDE.md, src/lib/export-service.ts, src/lib/security-service.ts## FULL FILE CONTEXT SUMMARY
Query: You are an expert code analyst examining the github repository: https://github.com/ashish921998/Vinesight (Vinesight).
You provide direct, concise, and accurate information about code repositories.
You NEVER start responses with markdown headers or code fences.
IMPORTANT:You MUST respond in English language.
Total Files Included: 18
Total Files Skipped: 0
Total Context Tokens: 68,079 / 800,000 (8.5%)
Remaining Token Budget: 731,921
Included Files:
- AGENTS.md (470 tokens)
- src/app/terms/page.tsx (5,976 tokens)
- src/app/privacy/page.tsx (5,320 tokens)
- context/PRD.md (4,263 tokens)
- src/app/grape-farming-guide/page.tsx (1,906 tokens)
- src/lib/i18n.ts (12,148 tokens)
- public/sitemap.xml (1,993 tokens)
- CLAUDE.md (6,358 tokens)
- src/app/reports/page.tsx (8,015 tokens)
- src/app/help/page.tsx (3,545 tokens)
- context/TYPES_AND_INTERFACES.md (3,308 tokens)
- context/todos.md (1,742 tokens)
- README.md (357 tokens)
- package.json (1,001 tokens)
- src/lib/export-service.ts (5,895 tokens)
- src/app/precision-agriculture/page.tsx (2,814 tokens)
- src/lib/security-service.ts (1,441 tokens)
- src/app/layout.tsx (1,527 tokens)
Build & Development Commands
npm run devornpm run dev --turbopack- Start development servernpm run build- Production buildnpm run typecheck- Run TypeScript type checkingnpm run lint- Run ESLintnpm run start- Start production server- No test framework configured - check with user before assuming test setup
Architecture & Structure
- Framework: Next.js 15 with App Router, React 19, TypeScript
- Database: Supabase with PostgreSQL and Row Level Security
- UI: shadcn/ui components with Radix UI and Tailwind CSS
- AI: Multiple providers (OpenAI, Google AI, Groq) with TensorFlow.js for computer vision
- PWA: Progressive Web App with offline support via next-pwa and Dexie
- Internationalization: i18next with Hindi/Marathi support
- Key directories:
src/app/(pages),src/components/(UI),src/lib/(services),src/hooks/(React hooks)
Code Style & Conventions
- Imports: Use
@/path alias for src imports, separate UI from business logic imports - Components: PascalCase files (.tsx), functional components with TypeScript interfaces
- Props: ComponentNameProps interface pattern (e.g.,
SprayFormProps) - Hooks: camelCase with
useprefix, custom hooks insrc/hooks/ - Functions: camelCase with descriptive verbs (handleSubmit, fetchData)
- Files: PascalCase components, kebab-case utilities, camelCase hooks
- State: Prefer useState with descriptive names, avoid suppressing TS errors
- Styling: Use cn() utility for conditional classes, shadcn/ui component variants
- Error handling: Follow security best practices, never expose secrets or use background processes
Database & Types
- Supabase: Row Level Security enabled, type-safe database operations
- Types: Generated from Supabase schema, use proper Database types
- Auth: Supabase Auth with custom useSupabaseAuth hook
================================================================================
'use client'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import {
ArrowLeft,
FileText,
Shield,
Users,
AlertTriangle,
CheckCircle,
Scale,
Phone,
Mail,
Globe,
Calendar,
CreditCard,
} from 'lucide-react'
import { SEOSchema } from '@/components/SEOSchema'
import Link from 'next/link'
export default function TermsOfServicePage() {
return (
{/* Header */}
<div className="bg-white border-b border-gray-200">
<div className="max-w-4xl mx-auto px-4 py-6">
<div className="flex items-center gap-4 mb-6">
<Link href="/">
<Button variant="ghost" size="sm">
<ArrowLeft className="h-4 w-4 mr-2" />
Back to Home
</Button>
</Link>
</div>
<div className="text-center max-w-3xl mx-auto">
<div className="flex items-center justify-center gap-3 mb-4">
<div className="w-12 h-12 bg-gradient-to-br from-purple-500 to-purple-600 rounded-2xl flex items-center justify-center">
<Scale className="h-7 w-7 text-white" />
</div>
<h1 className="text-4xl font-bold text-gray-900">Terms of Service</h1>
</div>
<p className="text-xl text-gray-600 mb-4">Terms and conditions for using VineSight</p>
<p className="text-sm text-gray-500">Last updated: January 15, 2024</p>
</div>
</div>
</div>
<div className="max-w-4xl mx-auto px-4 py-12">
{/* Overview */}
<div className="mb-12">
<Card className="border-2 border-purple-200 bg-purple-50">
<CardContent className="p-8">
<div className="flex items-start gap-4">
<FileText className="h-8 w-8 text-purple-600 mt-1" />
<div>
<h2 className="text-xl font-semibold text-gray-900 mb-3">Agreement Overview</h2>
<p className="text-gray-700 mb-4">
These Terms of Service ("Terms") govern your access to and use of
VineSight's agricultural platform and services. By using our platform, you
agree to these terms and our Privacy Policy.
</p>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="flex items-center gap-2">
<CheckCircle className="h-5 w-5 text-purple-600" />
<span className="font-medium text-sm">Fair Use Policy</span>
</div>
<div className="flex items-center gap-2">
<Shield className="h-5 w-5 text-purple-600" />
<span className="font-medium text-sm">Data Protection</span>
</div>
<div className="flex items-center gap-2">
<Users className="h-5 w-5 text-purple-600" />
<span className="font-medium text-sm">Community Standards</span>
</div>
</div>
</div>
</div>
</CardContent>
</Card>
</div>
{/* Content Sections */}
<div className="space-y-8">
{/* Acceptance of Terms */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<CheckCircle className="h-6 w-6 text-green-600" />
Acceptance of Terms
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-gray-700">
By accessing or using VineSight's services, you acknowledge that you have read,
understood, and agree to be bound by these Terms. If you do not agree to these
Terms, you may not use our services.
</p>
<div className="bg-green-50 border border-green-200 rounded-lg p-4">
<h3 className="font-semibold text-green-900 mb-2">Eligibility Requirements</h3>
<ul className="space-y-1 text-green-800 text-sm">
<li>• Must be at least 18 years old or have parental consent</li>
<li>• Must be engaged in or interested in agricultural activities</li>
<li>• Must provide accurate and complete registration information</li>
<li>• Must comply with all applicable local, state, and national laws</li>
</ul>
</div>
</CardContent>
</Card>
{/* Service Description */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Globe className="h-6 w-6 text-blue-600" />
Service Description
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-gray-700">
VineSight provides a comprehensive digital platform for grape farming management,
including:
</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">Core Features</h3>
<ul className="space-y-2 text-gray-700">
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">Farm management and record keeping</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">Scientific calculators (ETc, MAD, nutrients)</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">Weather data and irrigation planning</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">Expense tracking and profitability analysis</span>
</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">AI-Powered Services</h3>
<ul className="space-y-2 text-gray-700">
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">Disease and pest prediction</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">Personalized farming recommendations</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">Market intelligence and pricing insights</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5" />
<span className="text-sm">AI assistant for farming queries</span>
</li>
</ul>
</div>
</div>
</CardContent>
</Card>
{/* User Responsibilities */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Users className="h-6 w-6 text-orange-600" />
User Responsibilities
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-4">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Account Security</h3>
<ul className="space-y-2 text-gray-700 ml-4">
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>
Maintain the security and confidentiality of your account credentials
</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Notify us immediately of any unauthorized access to your account</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Keep your contact information current and accurate</span>
</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Data Accuracy</h3>
<ul className="space-y-2 text-gray-700 ml-4">
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>
Provide accurate and complete information about your farm and operations
</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Update information promptly when circumstances change</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Verify AI recommendations against local conditions and expertise</span>
</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Acceptable Use</h3>
<ul className="space-y-2 text-gray-700 ml-4">
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Use services only for legitimate agricultural purposes</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Respect intellectual property rights and community guidelines</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Comply with all applicable laws and regulations</span>
</li>
</ul>
</div>
</div>
</CardContent>
</Card>
{/* Prohibited Activities */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<AlertTriangle className="h-6 w-6 text-red-600" />
Prohibited Activities
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="bg-red-50 border border-red-200 rounded-lg p-4">
<p className="text-red-800 font-medium mb-2">
The following activities are strictly prohibited:
</p>
<ul className="space-y-2 text-red-700 text-sm">
<li>• Sharing account credentials or allowing unauthorized access</li>
<li>• Attempting to reverse engineer, decompile, or extract our algorithms</li>
<li>• Using automated tools to access our services without permission</li>
<li>• Uploading malicious content or attempting to compromise system security</li>
<li>• Misrepresenting your identity or providing false information</li>
<li>• Using the platform for illegal activities or to harm others</li>
<li>• Attempting to circumvent usage limits or access restrictions</li>
</ul>
</div>
<p className="text-gray-700">
Violations of these prohibitions may result in immediate account suspension or
termination, and may be reported to relevant authorities if illegal activity is
suspected.
</p>
</CardContent>
</Card>
{/* Intellectual Property */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Shield className="h-6 w-6 text-purple-600" />
Intellectual Property Rights
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">Our Rights</h3>
<ul className="space-y-2 text-gray-700">
<li className="flex items-start gap-2">
<Shield className="h-4 w-4 text-purple-600 mt-0.5" />
<span className="text-sm">VineSight platform, software, and algorithms</span>
</li>
<li className="flex items-start gap-2">
<Shield className="h-4 w-4 text-purple-600 mt-0.5" />
<span className="text-sm">Trademarks, logos, and brand materials</span>
</li>
<li className="flex items-start gap-2">
<Shield className="h-4 w-4 text-purple-600 mt-0.5" />
<span className="text-sm">AI models and prediction systems</span>
</li>
<li className="flex items-start gap-2">
<Shield className="h-4 w-4 text-purple-600 mt-0.5" />
<span className="text-sm">User interface and experience design</span>
</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">Your Rights</h3>
<ul className="space-y-2 text-gray-700">
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Your farming data remains your property</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Photos and content you upload</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Right to export your data anytime</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Limited license to use our platform</span>
</li>
</ul>
</div>
</div>
</CardContent>
</Card>
{/* Service Availability & Changes */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Calendar className="h-6 w-6 text-indigo-600" />
Service Availability & Changes
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-4">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Service Availability</h3>
<p className="text-gray-700 mb-2">
We strive to provide reliable service but cannot guarantee 100% uptime due to:
</p>
<ul className="space-y-1 text-gray-700 ml-4 text-sm">
<li>• Scheduled maintenance and updates</li>
<li>• Internet connectivity issues</li>
<li>• Third-party service dependencies (weather data, mapping services)</li>
<li>• Unexpected technical difficulties</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">
Service Modifications
</h3>
<p className="text-gray-700">
We reserve the right to modify, update, or discontinue features with reasonable
notice. Major changes affecting core functionality will be communicated at least
30 days in advance.
</p>
</div>
</div>
</CardContent>
</Card>
{/* Payment Terms */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<CreditCard className="h-6 w-6 text-green-600" />
Payment Terms
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">Free Services</h3>
<p className="text-gray-700 mb-2">
Basic features are available at no cost, including:
</p>
<ul className="space-y-1 text-gray-700 text-sm">
<li>• Farm registration and basic record keeping</li>
<li>• Weather data and ETc calculations</li>
<li>• Limited AI assistant interactions</li>
<li>• Basic analytics and reporting</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">Premium Features</h3>
<p className="text-gray-700 mb-2">Advanced features may require subscription:</p>
<ul className="space-y-1 text-gray-700 text-sm">
<li>• Advanced AI predictions and recommendations</li>
<li>• Unlimited data storage and history</li>
<li>• Priority customer support</li>
<li>• Integration with IoT devices</li>
</ul>
</div>
</div>
<div className="bg-green-50 border border-green-200 rounded-lg p-4">
<h4 className="font-semibold text-green-900 mb-2">Payment Policy</h4>
<ul className="space-y-1 text-green-800 text-sm">
<li>• All prices are in Indian Rupees (INR) unless otherwise specified</li>
<li>• Subscriptions are billed monthly or annually as selected</li>
<li>• Refunds available within 7 days of purchase for annual plans</li>
<li>• You can cancel your subscription at any time</li>
</ul>
</div>
</CardContent>
</Card>
{/* Disclaimers */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<AlertTriangle className="h-6 w-6 text-yellow-600" />
Important Disclaimers
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
<h3 className="font-semibold text-yellow-900 mb-2">Agricultural Guidance</h3>
<p className="text-yellow-800 text-sm mb-2">
VineSight provides information and recommendations based on data analysis and
agricultural science. However, farming decisions should always consider:
</p>
<ul className="space-y-1 text-yellow-800 text-sm">
<li>• Local conditions and micro-climate variations</li>
<li>• Expert advice from agricultural extension officers</li>
<li>• Regulatory requirements and safety guidelines</li>
<li>• Your own experience and observation</li>
</ul>
</div>
<div className="bg-red-50 border border-red-200 rounded-lg p-4">
<h3 className="font-semibold text-red-900 mb-2">Limitation of Liability</h3>
<p className="text-red-800 text-sm">
VineSight provides services "as is" and cannot be held liable for crop
losses, equipment damage, or other agricultural outcomes resulting from use of our
platform. Users are responsible for validating all recommendations against local
conditions and expert advice.
</p>
</div>
</CardContent>
</Card>
{/* Termination */}
<Card>
<CardHeader>
<CardTitle>Account Termination</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">By You</h3>
<p className="text-gray-700 mb-2">
You may terminate your account at any time by:
</p>
<ul className="space-y-1 text-gray-700 text-sm">
<li>• Using account deletion option in settings</li>
<li>• Contacting our support team</li>
<li>• Your data will be deleted within 30 days</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">By Us</h3>
<p className="text-gray-700 mb-2">We may suspend/terminate accounts for:</p>
<ul className="space-y-1 text-gray-700 text-sm">
<li>• Violation of these terms</li>
<li>• Illegal or harmful activities</li>
<li>• Extended inactivity (with notice)</li>
</ul>
</div>
</div>
</CardContent>
</Card>
{/* Governing Law */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Scale className="h-6 w-6 text-purple-600" />
Governing Law & Disputes
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-gray-700 mb-4">
These Terms are governed by the laws of India. Any disputes will be resolved
through:
</p>
<div className="space-y-3">
<div className="flex items-start gap-3">
<div className="w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center">
<Users className="h-4 w-4 text-purple-600" />
</div>
<div>
<h4 className="font-semibold text-gray-900">1. Direct Communication</h4>
<p className="text-sm text-gray-600">
We encourage resolving disputes through direct communication with our support
team
</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center">
<Scale className="h-4 w-4 text-purple-600" />
</div>
<div>
<h4 className="font-semibold text-gray-900">2. Arbitration</h4>
<p className="text-sm text-gray-600">
Unresolved disputes may be subject to binding arbitration under Indian
Arbitration law
</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center">
<FileText className="h-4 w-4 text-purple-600" />
</div>
<div>
<h4 className="font-semibold text-gray-900">3. Jurisdiction</h4>
<p className="text-sm text-gray-600">
Courts in Maharashtra, India have exclusive jurisdiction for any legal
proceedings
</p>
</div>
</div>
</div>
</CardContent>
</Card>
{/* Contact Information */}
<Card className="border-2 border-purple-200 bg-purple-50">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Phone className="h-6 w-6 text-purple-600" />
Questions About These Terms?
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-gray-700 mb-4">
If you have questions about these Terms of Service, please contact us:
</p>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="text-center">
<Mail className="h-8 w-8 text-purple-600 mx-auto mb-2" />
<p className="font-semibold text-gray-900">Email</p>
<p className="text-sm text-gray-600">legal@vinesight.in</p>
</div>
<div className="text-center">
<Phone className="h-8 w-8 text-purple-600 mx-auto mb-2" />
<p className="font-semibold text-gray-900">Phone</p>
<p className="text-sm text-gray-600">+91-XXX-XXX-XXXX</p>
</div>
<div className="text-center">
<Globe className="h-8 w-8 text-purple-600 mx-auto mb-2" />
<p className="font-semibold text-gray-900">Website</p>
<p className="text-sm text-gray-600">www.vinesight.in</p>
</div>
</div>
</CardContent>
</Card>
</div>
{/* Footer */}
<div className="mt-16 text-center">
<p className="text-gray-500 text-sm">
By using VineSight, you acknowledge that you have read, understood, and agree to these
Terms of Service.
</p>
</div>
</div>
</div>
)
}
================================================================================
'use client'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import {
ArrowLeft,
Shield,
Lock,
Eye,
Server,
Users,
Mail,
FileText,
AlertTriangle,
CheckCircle,
} from 'lucide-react'
import { SEOSchema } from '@/components/SEOSchema'
import Link from 'next/link'
export default function PrivacyPolicyPage() {
return (
{/* Header */}
<div className="bg-white border-b border-gray-200">
<div className="max-w-4xl mx-auto px-4 py-6">
<div className="flex items-center gap-4 mb-6">
<Link href="/">
<Button variant="ghost" size="sm">
<ArrowLeft className="h-4 w-4 mr-2" />
Back to Home
</Button>
</Link>
</div>
<div className="text-center max-w-3xl mx-auto">
<div className="flex items-center justify-center gap-3 mb-4">
<div className="w-12 h-12 bg-gradient-to-br from-blue-500 to-blue-600 rounded-2xl flex items-center justify-center">
<Shield className="h-7 w-7 text-white" />
</div>
<h1 className="text-4xl font-bold text-gray-900">Privacy Policy</h1>
</div>
<p className="text-xl text-gray-600 mb-4">How we protect and handle your data</p>
<p className="text-sm text-gray-500">Last updated: January 15, 2024</p>
</div>
</div>
</div>
<div className="max-w-4xl mx-auto px-4 py-12">
{/* Overview */}
<div className="mb-12">
<Card className="border-2 border-green-200 bg-green-50">
<CardContent className="p-8">
<div className="flex items-start gap-4">
<CheckCircle className="h-8 w-8 text-green-600 mt-1" />
<div>
<h2 className="text-xl font-semibold text-gray-900 mb-3">
Our Privacy Commitment
</h2>
<p className="text-gray-700 mb-4">
At VineSight, we understand that your farming data is valuable and sensitive. We
are committed to protecting your privacy and being transparent about how we
collect, use, and protect your information.
</p>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="flex items-center gap-2">
<Lock className="h-5 w-5 text-green-600" />
<span className="font-medium text-sm">Data Encryption</span>
</div>
<div className="flex items-center gap-2">
<Shield className="h-5 w-5 text-green-600" />
<span className="font-medium text-sm">Secure Storage</span>
</div>
<div className="flex items-center gap-2">
<Eye className="h-5 w-5 text-green-600" />
<span className="font-medium text-sm">No Third-Party Sharing</span>
</div>
</div>
</div>
</div>
</CardContent>
</Card>
</div>
{/* Content Sections */}
<div className="space-y-8">
{/* Information We Collect */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<FileText className="h-6 w-6 text-blue-600" />
Information We Collect
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Personal Information</h3>
<ul className="space-y-2 text-gray-700 ml-4">
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Name, email address, and phone number when you register</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Farm location and basic details for personalized services</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Profile preferences and language settings</span>
</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Farming Data</h3>
<ul className="space-y-2 text-gray-700 ml-4">
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Irrigation records, spray applications, and harvest data</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Expense tracking and cost calculations</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Photos uploaded for AI analysis (disease detection, etc.)</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Weather and environmental data linked to your farm</span>
</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Technical Information</h3>
<ul className="space-y-2 text-gray-700 ml-4">
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Device type, browser information, and IP address</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Usage patterns and feature interactions for improvement</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full mt-2"></span>
<span>Error logs and performance data to ensure reliability</span>
</li>
</ul>
</div>
</CardContent>
</Card>
{/* How We Use Your Information */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Users className="h-6 w-6 text-green-600" />
How We Use Your Information
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">Service Delivery</h3>
<ul className="space-y-2 text-gray-700">
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Provide personalized farming recommendations</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">
Generate accurate irrigation and spray schedules
</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">AI-powered pest and disease predictions</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Calculate ETc, MAD, and nutrient requirements</span>
</li>
</ul>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">
Improvement & Support
</h3>
<ul className="space-y-2 text-gray-700">
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Improve AI models and predictions</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Provide technical support and troubleshooting</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Send important updates and notifications</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Analyze usage to develop new features</span>
</li>
</ul>
</div>
</div>
</CardContent>
</Card>
{/* Data Protection & Security */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Lock className="h-6 w-6 text-purple-600" />
Data Protection & Security
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-gray-700">
We implement industry-standard security measures to protect your data:
</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-3">
<div className="flex items-start gap-3">
<div className="w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center">
<Lock className="h-4 w-4 text-purple-600" />
</div>
<div>
<h4 className="font-semibold text-gray-900">Encryption</h4>
<p className="text-sm text-gray-600">
All data transmitted and stored is encrypted using AES-256
</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center">
<Server className="h-4 w-4 text-purple-600" />
</div>
<div>
<h4 className="font-semibold text-gray-900">Secure Infrastructure</h4>
<p className="text-sm text-gray-600">
Data hosted on secure cloud servers with regular backups
</p>
</div>
</div>
</div>
<div className="space-y-3">
<div className="flex items-start gap-3">
<div className="w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center">
<Shield className="h-4 w-4 text-purple-600" />
</div>
<div>
<h4 className="font-semibold text-gray-900">Access Control</h4>
<p className="text-sm text-gray-600">
Strict access controls and authentication protocols
</p>
</div>
</div>
<div className="flex items-start gap-3">
<div className="w-8 h-8 bg-purple-100 rounded-lg flex items-center justify-center">
<Eye className="h-4 w-4 text-purple-600" />
</div>
<div>
<h4 className="font-semibold text-gray-900">Privacy by Design</h4>
<p className="text-sm text-gray-600">
Data minimization and purpose limitation principles
</p>
</div>
</div>
</div>
</div>
</CardContent>
</Card>
{/* Data Sharing & Third Parties */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Users className="h-6 w-6 text-orange-600" />
Data Sharing & Third Parties
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="bg-red-50 border border-red-200 rounded-lg p-4">
<div className="flex items-start gap-2">
<AlertTriangle className="h-5 w-5 text-red-600 mt-0.5" />
<div>
<h3 className="font-semibold text-red-900 mb-1">We Do NOT Sell Your Data</h3>
<p className="text-red-700 text-sm">
VineSight never sells, rents, or trades your personal or farming data to third
parties.
</p>
</div>
</div>
</div>
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-2">Limited Sharing</h3>
<p className="text-gray-700 mb-3">
We only share data in these specific circumstances:
</p>
<ul className="space-y-2 text-gray-700 ml-4">
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>With your explicit consent for specific integrations</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Anonymized data for agricultural research (optional participation)</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Legal requirements or to protect rights and safety</span>
</li>
<li className="flex items-start gap-2">
<span className="w-2 h-2 bg-orange-500 rounded-full mt-2"></span>
<span>Trusted service providers bound by confidentiality agreements</span>
</li>
</ul>
</div>
</CardContent>
</Card>
{/* Your Rights */}
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<CheckCircle className="h-6 w-6 text-green-600" />
Your Rights & Choices
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-gray-700">
You have complete control over your data with VineSight:
</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 className="text-lg font-semibold text-gray-900 mb-3">
Data Access & Control
</h3>
<ul className="space-y-2 text-gray-700">
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">View and download all your data</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Correct or update incorrect information</span>
</li>
<li className="flex items-start gap-2">
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5" />
<span className="text-sm">Delete specific records or entire account</span>
</li>
<li className="flex items-start gap-2">
<