@deepintel-ltd/farmpro-contracts 1.0.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,22 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
3
  * Category schemas - JSON:API compliant
4
+ * Categories are universal and can be used for tasks, budgets, and expenses
4
5
  */
5
- export declare const categoryTypeSchema: z.ZodEnum<["task", "budget", "expense"]>;
6
6
  export declare const categoryAttributesSchema: z.ZodObject<{
7
7
  name: z.ZodString;
8
- type: z.ZodEnum<["task", "budget", "expense"]>;
9
8
  farmId: z.ZodNullable<z.ZodString>;
10
9
  isDefault: z.ZodBoolean;
11
10
  } & {
12
11
  createdAt: z.ZodString;
13
12
  updatedAt: z.ZodString;
14
13
  }, "strip", z.ZodTypeAny, {
15
- type: "expense" | "task" | "budget";
16
14
  createdAt: string;
17
15
  updatedAt: string;
18
16
  name: string;
19
17
  farmId: string | null;
20
18
  isDefault: boolean;
21
19
  }, {
22
- type: "expense" | "task" | "budget";
23
20
  createdAt: string;
24
21
  updatedAt: string;
25
22
  name: string;
@@ -28,16 +25,13 @@ export declare const categoryAttributesSchema: z.ZodObject<{
28
25
  }>;
29
26
  export declare const createCategoryAttributesSchema: z.ZodObject<{
30
27
  name: z.ZodString;
31
- type: z.ZodEnum<["task", "budget", "expense"]>;
32
28
  farmId: z.ZodOptional<z.ZodString>;
33
29
  isDefault: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
34
30
  }, "strip", z.ZodTypeAny, {
35
- type: "expense" | "task" | "budget";
36
31
  name: string;
37
32
  isDefault: boolean;
38
33
  farmId?: string | undefined;
39
34
  }, {
40
- type: "expense" | "task" | "budget";
41
35
  name: string;
42
36
  farmId?: string | undefined;
43
37
  isDefault?: boolean | undefined;
@@ -56,16 +50,13 @@ export declare const createCategorySchema: z.ZodObject<{
56
50
  type: z.ZodLiteral<"categories">;
57
51
  attributes: z.ZodObject<{
58
52
  name: z.ZodString;
59
- type: z.ZodEnum<["task", "budget", "expense"]>;
60
53
  farmId: z.ZodOptional<z.ZodString>;
61
54
  isDefault: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
62
55
  }, "strip", z.ZodTypeAny, {
63
- type: "expense" | "task" | "budget";
64
56
  name: string;
65
57
  isDefault: boolean;
66
58
  farmId?: string | undefined;
67
59
  }, {
68
- type: "expense" | "task" | "budget";
69
60
  name: string;
70
61
  farmId?: string | undefined;
71
62
  isDefault?: boolean | undefined;
@@ -73,7 +64,6 @@ export declare const createCategorySchema: z.ZodObject<{
73
64
  }, "strip", z.ZodTypeAny, {
74
65
  type: "categories";
75
66
  attributes: {
76
- type: "expense" | "task" | "budget";
77
67
  name: string;
78
68
  isDefault: boolean;
79
69
  farmId?: string | undefined;
@@ -81,7 +71,6 @@ export declare const createCategorySchema: z.ZodObject<{
81
71
  }, {
82
72
  type: "categories";
83
73
  attributes: {
84
- type: "expense" | "task" | "budget";
85
74
  name: string;
86
75
  farmId?: string | undefined;
87
76
  isDefault?: boolean | undefined;
@@ -120,21 +109,18 @@ export declare const categoryResourceSchema: z.ZodObject<{
120
109
  id: z.ZodString;
121
110
  attributes: z.ZodObject<{
122
111
  name: z.ZodString;
123
- type: z.ZodEnum<["task", "budget", "expense"]>;
124
112
  farmId: z.ZodNullable<z.ZodString>;
125
113
  isDefault: z.ZodBoolean;
126
114
  } & {
127
115
  createdAt: z.ZodString;
128
116
  updatedAt: z.ZodString;
129
117
  }, "strip", z.ZodTypeAny, {
130
- type: "expense" | "task" | "budget";
131
118
  createdAt: string;
132
119
  updatedAt: string;
133
120
  name: string;
134
121
  farmId: string | null;
135
122
  isDefault: boolean;
136
123
  }, {
137
- type: "expense" | "task" | "budget";
138
124
  createdAt: string;
139
125
  updatedAt: string;
140
126
  name: string;
@@ -148,7 +134,6 @@ export declare const categoryResourceSchema: z.ZodObject<{
148
134
  type: string;
149
135
  id: string;
150
136
  attributes: {
151
- type: "expense" | "task" | "budget";
152
137
  createdAt: string;
153
138
  updatedAt: string;
154
139
  name: string;
@@ -162,7 +147,6 @@ export declare const categoryResourceSchema: z.ZodObject<{
162
147
  type: string;
163
148
  id: string;
164
149
  attributes: {
165
- type: "expense" | "task" | "budget";
166
150
  createdAt: string;
167
151
  updatedAt: string;
168
152
  name: string;
@@ -179,21 +163,18 @@ export declare const categoryResponseSchema: z.ZodObject<{
179
163
  id: z.ZodString;
180
164
  attributes: z.ZodObject<{
181
165
  name: z.ZodString;
182
- type: z.ZodEnum<["task", "budget", "expense"]>;
183
166
  farmId: z.ZodNullable<z.ZodString>;
184
167
  isDefault: z.ZodBoolean;
185
168
  } & {
186
169
  createdAt: z.ZodString;
187
170
  updatedAt: z.ZodString;
188
171
  }, "strip", z.ZodTypeAny, {
189
- type: "expense" | "task" | "budget";
190
172
  createdAt: string;
191
173
  updatedAt: string;
192
174
  name: string;
193
175
  farmId: string | null;
194
176
  isDefault: boolean;
195
177
  }, {
196
- type: "expense" | "task" | "budget";
197
178
  createdAt: string;
198
179
  updatedAt: string;
199
180
  name: string;
@@ -207,7 +188,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
207
188
  type: string;
208
189
  id: string;
209
190
  attributes: {
210
- type: "expense" | "task" | "budget";
211
191
  createdAt: string;
212
192
  updatedAt: string;
213
193
  name: string;
@@ -221,7 +201,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
221
201
  type: string;
222
202
  id: string;
223
203
  attributes: {
224
- type: "expense" | "task" | "budget";
225
204
  createdAt: string;
226
205
  updatedAt: string;
227
206
  name: string;
@@ -261,7 +240,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
261
240
  type: string;
262
241
  id: string;
263
242
  attributes: {
264
- type: "expense" | "task" | "budget";
265
243
  createdAt: string;
266
244
  updatedAt: string;
267
245
  name: string;
@@ -287,7 +265,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
287
265
  type: string;
288
266
  id: string;
289
267
  attributes: {
290
- type: "expense" | "task" | "budget";
291
268
  createdAt: string;
292
269
  updatedAt: string;
293
270
  name: string;
@@ -315,21 +292,18 @@ export declare const categoryListResponseSchema: z.ZodObject<{
315
292
  id: z.ZodString;
316
293
  attributes: z.ZodObject<{
317
294
  name: z.ZodString;
318
- type: z.ZodEnum<["task", "budget", "expense"]>;
319
295
  farmId: z.ZodNullable<z.ZodString>;
320
296
  isDefault: z.ZodBoolean;
321
297
  } & {
322
298
  createdAt: z.ZodString;
323
299
  updatedAt: z.ZodString;
324
300
  }, "strip", z.ZodTypeAny, {
325
- type: "expense" | "task" | "budget";
326
301
  createdAt: string;
327
302
  updatedAt: string;
328
303
  name: string;
329
304
  farmId: string | null;
330
305
  isDefault: boolean;
331
306
  }, {
332
- type: "expense" | "task" | "budget";
333
307
  createdAt: string;
334
308
  updatedAt: string;
335
309
  name: string;
@@ -343,7 +317,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
343
317
  type: string;
344
318
  id: string;
345
319
  attributes: {
346
- type: "expense" | "task" | "budget";
347
320
  createdAt: string;
348
321
  updatedAt: string;
349
322
  name: string;
@@ -357,7 +330,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
357
330
  type: string;
358
331
  id: string;
359
332
  attributes: {
360
- type: "expense" | "task" | "budget";
361
333
  createdAt: string;
362
334
  updatedAt: string;
363
335
  name: string;
@@ -397,7 +369,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
397
369
  type: string;
398
370
  id: string;
399
371
  attributes: {
400
- type: "expense" | "task" | "budget";
401
372
  createdAt: string;
402
373
  updatedAt: string;
403
374
  name: string;
@@ -423,7 +394,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
423
394
  type: string;
424
395
  id: string;
425
396
  attributes: {
426
- type: "expense" | "task" | "budget";
427
397
  createdAt: string;
428
398
  updatedAt: string;
429
399
  name: string;
@@ -446,19 +416,15 @@ export declare const categoryListResponseSchema: z.ZodObject<{
446
416
  }[] | undefined;
447
417
  }>;
448
418
  export declare const getCategoriesQuerySchema: z.ZodObject<{
449
- type: z.ZodOptional<z.ZodEnum<["task", "budget", "expense"]>>;
450
419
  farmId: z.ZodOptional<z.ZodString>;
451
420
  includeDefaults: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
452
421
  }, "strip", z.ZodTypeAny, {
453
422
  includeDefaults: boolean;
454
- type?: "expense" | "task" | "budget" | undefined;
455
423
  farmId?: string | undefined;
456
424
  }, {
457
- type?: "expense" | "task" | "budget" | undefined;
458
425
  farmId?: string | undefined;
459
426
  includeDefaults?: boolean | undefined;
460
427
  }>;
461
- export type CategoryType = z.infer<typeof categoryTypeSchema>;
462
428
  export type CreateCategoryAttributes = z.infer<typeof createCategoryAttributesSchema>;
463
429
  export type UpdateCategoryAttributes = z.infer<typeof updateCategoryAttributesSchema>;
464
430
  export type CreateCategoryInput = z.infer<typeof createCategorySchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"categories.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/categories.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;GAEG;AAGH,eAAO,MAAM,kBAAkB,0CAAwC,CAAC;AAGxE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;EAKX,CAAC;AAG3B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;EAKzC,CAAC;AAGH,eAAO,MAAM,8BAA8B;;;;;;;;;EAGzC,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/B,CAAC;AAGH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsE,CAAC;AAG1G,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -1,24 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCategoriesQuerySchema = exports.categoryListResponseSchema = exports.categoryResponseSchema = exports.categoryResourceSchema = exports.updateCategorySchema = exports.createCategorySchema = exports.updateCategoryAttributesSchema = exports.createCategoryAttributesSchema = exports.categoryAttributesSchema = exports.categoryTypeSchema = void 0;
3
+ exports.getCategoriesQuerySchema = exports.categoryListResponseSchema = exports.categoryResponseSchema = exports.categoryResourceSchema = exports.updateCategorySchema = exports.createCategorySchema = exports.updateCategoryAttributesSchema = exports.createCategoryAttributesSchema = exports.categoryAttributesSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const common_schemas_1 = require("./common.schemas");
6
6
  /**
7
7
  * Category schemas - JSON:API compliant
8
+ * Categories are universal and can be used for tasks, budgets, and expenses
8
9
  */
9
- // Category type enum
10
- exports.categoryTypeSchema = zod_1.z.enum(['task', 'budget', 'expense']);
11
10
  // Category attributes schema (for JSON:API attributes object)
12
11
  exports.categoryAttributesSchema = zod_1.z.object({
13
12
  name: zod_1.z.string(),
14
- type: exports.categoryTypeSchema,
15
13
  farmId: zod_1.z.string().uuid().nullable(),
16
14
  isDefault: zod_1.z.boolean(),
17
15
  }).merge(common_schemas_1.timestampsSchema);
18
16
  // Category attributes for creation (input)
19
17
  exports.createCategoryAttributesSchema = zod_1.z.object({
20
18
  name: zod_1.z.string().min(1).max(100),
21
- type: exports.categoryTypeSchema,
22
19
  farmId: zod_1.z.string().uuid().optional(), // Optional - if not provided, creates system default
23
20
  isDefault: zod_1.z.boolean().optional().default(false),
24
21
  });
@@ -45,7 +42,6 @@ exports.categoryResponseSchema = (0, common_schemas_1.jsonApiSingleResponseSchem
45
42
  exports.categoryListResponseSchema = (0, common_schemas_1.jsonApiCollectionResponseSchema)(exports.categoryResourceSchema);
46
43
  // Get categories query parameters
47
44
  exports.getCategoriesQuerySchema = zod_1.z.object({
48
- type: exports.categoryTypeSchema.optional(),
49
45
  farmId: zod_1.z.string().uuid().optional(),
50
- includeDefaults: zod_1.z.boolean().optional().default(true),
46
+ includeDefaults: zod_1.z.coerce.boolean().optional().default(true),
51
47
  });
@@ -0,0 +1,216 @@
1
+ import { z } from 'zod';
2
+ export declare const fieldMonitoringSummarySchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ fieldId: z.ZodString;
5
+ fieldName: z.ZodString;
6
+ latestDate: z.ZodString;
7
+ currentNDVI: z.ZodNullable<z.ZodNumber>;
8
+ currentNDWI: z.ZodNullable<z.ZodNumber>;
9
+ currentEVI: z.ZodNullable<z.ZodNumber>;
10
+ currentCropHealth: z.ZodNullable<z.ZodEnum<["poor", "fair", "good", "excellent"]>>;
11
+ currentWaterStress: z.ZodNullable<z.ZodEnum<["none", "low", "medium", "high"]>>;
12
+ overallStatus: z.ZodEnum<["ok", "warning", "critical"]>;
13
+ activeAlertCount: z.ZodNumber;
14
+ lastAlertDate: z.ZodNullable<z.ZodString>;
15
+ dataQuality: z.ZodNullable<z.ZodEnum<["excellent", "good", "fair", "poor"]>>;
16
+ cloudCover: z.ZodNullable<z.ZodNumber>;
17
+ lastProcessedAt: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ id: string;
20
+ fieldId: string;
21
+ fieldName: string;
22
+ latestDate: string;
23
+ currentNDVI: number | null;
24
+ currentNDWI: number | null;
25
+ currentEVI: number | null;
26
+ currentCropHealth: "poor" | "fair" | "good" | "excellent" | null;
27
+ currentWaterStress: "high" | "medium" | "low" | "none" | null;
28
+ overallStatus: "ok" | "critical" | "warning";
29
+ activeAlertCount: number;
30
+ lastAlertDate: string | null;
31
+ dataQuality: "poor" | "fair" | "good" | "excellent" | null;
32
+ cloudCover: number | null;
33
+ lastProcessedAt: string;
34
+ }, {
35
+ id: string;
36
+ fieldId: string;
37
+ fieldName: string;
38
+ latestDate: string;
39
+ currentNDVI: number | null;
40
+ currentNDWI: number | null;
41
+ currentEVI: number | null;
42
+ currentCropHealth: "poor" | "fair" | "good" | "excellent" | null;
43
+ currentWaterStress: "high" | "medium" | "low" | "none" | null;
44
+ overallStatus: "ok" | "critical" | "warning";
45
+ activeAlertCount: number;
46
+ lastAlertDate: string | null;
47
+ dataQuality: "poor" | "fair" | "good" | "excellent" | null;
48
+ cloudCover: number | null;
49
+ lastProcessedAt: string;
50
+ }>;
51
+ export type FieldMonitoringSummary = z.infer<typeof fieldMonitoringSummarySchema>;
52
+ export declare const ndviTrendDataPointSchema: z.ZodObject<{
53
+ time: z.ZodString;
54
+ ndvi: z.ZodNumber;
55
+ cloudCover: z.ZodNumber;
56
+ }, "strip", z.ZodTypeAny, {
57
+ time: string;
58
+ ndvi: number;
59
+ cloudCover: number;
60
+ }, {
61
+ time: string;
62
+ ndvi: number;
63
+ cloudCover: number;
64
+ }>;
65
+ export type NDVITrendDataPoint = z.infer<typeof ndviTrendDataPointSchema>;
66
+ export declare const weeklyNDVIStatsSchema: z.ZodObject<{
67
+ week: z.ZodString;
68
+ avgNdvi: z.ZodNumber;
69
+ maxNdvi: z.ZodNumber;
70
+ minNdvi: z.ZodNumber;
71
+ }, "strip", z.ZodTypeAny, {
72
+ week: string;
73
+ avgNdvi: number;
74
+ maxNdvi: number;
75
+ minNdvi: number;
76
+ }, {
77
+ week: string;
78
+ avgNdvi: number;
79
+ maxNdvi: number;
80
+ minNdvi: number;
81
+ }>;
82
+ export type WeeklyNDVIStats = z.infer<typeof weeklyNDVIStatsSchema>;
83
+ export declare const fieldAlertSchema: z.ZodObject<{
84
+ id: z.ZodString;
85
+ fieldId: z.ZodString;
86
+ fieldName: z.ZodOptional<z.ZodString>;
87
+ type: z.ZodString;
88
+ severity: z.ZodEnum<["low", "medium", "high", "critical"]>;
89
+ title: z.ZodString;
90
+ message: z.ZodString;
91
+ recommendation: z.ZodNullable<z.ZodString>;
92
+ status: z.ZodEnum<["active", "acknowledged", "resolved"]>;
93
+ acknowledgedAt: z.ZodNullable<z.ZodString>;
94
+ acknowledgedBy: z.ZodNullable<z.ZodString>;
95
+ resolvedAt: z.ZodNullable<z.ZodString>;
96
+ confidence: z.ZodNullable<z.ZodNumber>;
97
+ generatedBy: z.ZodString;
98
+ createdAt: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ type: string;
101
+ status: "active" | "acknowledged" | "resolved";
102
+ message: string;
103
+ id: string;
104
+ title: string;
105
+ createdAt: string;
106
+ fieldId: string;
107
+ severity: "critical" | "high" | "medium" | "low";
108
+ recommendation: string | null;
109
+ acknowledgedAt: string | null;
110
+ acknowledgedBy: string | null;
111
+ resolvedAt: string | null;
112
+ confidence: number | null;
113
+ generatedBy: string;
114
+ fieldName?: string | undefined;
115
+ }, {
116
+ type: string;
117
+ status: "active" | "acknowledged" | "resolved";
118
+ message: string;
119
+ id: string;
120
+ title: string;
121
+ createdAt: string;
122
+ fieldId: string;
123
+ severity: "critical" | "high" | "medium" | "low";
124
+ recommendation: string | null;
125
+ acknowledgedAt: string | null;
126
+ acknowledgedBy: string | null;
127
+ resolvedAt: string | null;
128
+ confidence: number | null;
129
+ generatedBy: string;
130
+ fieldName?: string | undefined;
131
+ }>;
132
+ export type FieldAlert = z.infer<typeof fieldAlertSchema>;
133
+ export declare const fieldComparisonSchema: z.ZodObject<{
134
+ fieldId: z.ZodString;
135
+ fieldName: z.ZodString;
136
+ avgNDVI: z.ZodNumber;
137
+ avgHealthScore: z.ZodNumber;
138
+ rank: z.ZodNumber;
139
+ }, "strip", z.ZodTypeAny, {
140
+ fieldId: string;
141
+ fieldName: string;
142
+ avgNDVI: number;
143
+ avgHealthScore: number;
144
+ rank: number;
145
+ }, {
146
+ fieldId: string;
147
+ fieldName: string;
148
+ avgNDVI: number;
149
+ avgHealthScore: number;
150
+ rank: number;
151
+ }>;
152
+ export type FieldComparison = z.infer<typeof fieldComparisonSchema>;
153
+ export declare const farmMonitoringStatsSchema: z.ZodObject<{
154
+ totalFields: z.ZodNumber;
155
+ healthyFields: z.ZodNumber;
156
+ warningFields: z.ZodNumber;
157
+ criticalFields: z.ZodNumber;
158
+ avgNDVI: z.ZodNumber;
159
+ totalActiveAlerts: z.ZodNumber;
160
+ }, "strip", z.ZodTypeAny, {
161
+ avgNDVI: number;
162
+ totalFields: number;
163
+ healthyFields: number;
164
+ warningFields: number;
165
+ criticalFields: number;
166
+ totalActiveAlerts: number;
167
+ }, {
168
+ avgNDVI: number;
169
+ totalFields: number;
170
+ healthyFields: number;
171
+ warningFields: number;
172
+ criticalFields: number;
173
+ totalActiveAlerts: number;
174
+ }>;
175
+ export type FarmMonitoringStats = z.infer<typeof farmMonitoringStatsSchema>;
176
+ export declare const ndviTrendQuerySchema: z.ZodObject<{
177
+ startDate: z.ZodString;
178
+ endDate: z.ZodString;
179
+ interval: z.ZodDefault<z.ZodEnum<["daily", "weekly"]>>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ startDate: string;
182
+ endDate: string;
183
+ interval: "daily" | "weekly";
184
+ }, {
185
+ startDate: string;
186
+ endDate: string;
187
+ interval?: "daily" | "weekly" | undefined;
188
+ }>;
189
+ export declare const alertsQuerySchema: z.ZodObject<{
190
+ status: z.ZodOptional<z.ZodEnum<["active", "acknowledged", "resolved"]>>;
191
+ }, "strip", z.ZodTypeAny, {
192
+ status?: "active" | "acknowledged" | "resolved" | undefined;
193
+ }, {
194
+ status?: "active" | "acknowledged" | "resolved" | undefined;
195
+ }>;
196
+ export declare const triggerAnalysisResponseSchema: z.ZodObject<{
197
+ message: z.ZodString;
198
+ jobId: z.ZodString;
199
+ }, "strip", z.ZodTypeAny, {
200
+ message: string;
201
+ jobId: string;
202
+ }, {
203
+ message: string;
204
+ jobId: string;
205
+ }>;
206
+ export declare const fieldMonitoringErrorResponseSchema: z.ZodObject<{
207
+ message: z.ZodString;
208
+ code: z.ZodOptional<z.ZodString>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ message: string;
211
+ code?: string | undefined;
212
+ }, {
213
+ message: string;
214
+ code?: string | undefined;
215
+ }>;
216
+ //# sourceMappingURL=field-monitoring.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-monitoring.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/field-monitoring.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAGF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAG1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAKhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAMhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAG5E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAGH,eAAO,MAAM,6BAA6B;;;;;;;;;EAGxC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;EAG7C,CAAC"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fieldMonitoringErrorResponseSchema = exports.triggerAnalysisResponseSchema = exports.alertsQuerySchema = exports.ndviTrendQuerySchema = exports.farmMonitoringStatsSchema = exports.fieldComparisonSchema = exports.fieldAlertSchema = exports.weeklyNDVIStatsSchema = exports.ndviTrendDataPointSchema = exports.fieldMonitoringSummarySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Field Monitoring Summary Schema
6
+ exports.fieldMonitoringSummarySchema = zod_1.z.object({
7
+ id: zod_1.z.string().uuid(),
8
+ fieldId: zod_1.z.string().uuid(),
9
+ fieldName: zod_1.z.string(),
10
+ latestDate: zod_1.z.string().datetime(),
11
+ currentNDVI: zod_1.z.number().min(-1).max(1).nullable(),
12
+ currentNDWI: zod_1.z.number().min(-1).max(1).nullable(),
13
+ currentEVI: zod_1.z.number().nullable(),
14
+ currentCropHealth: zod_1.z
15
+ .enum(['poor', 'fair', 'good', 'excellent'])
16
+ .nullable(),
17
+ currentWaterStress: zod_1.z
18
+ .enum(['none', 'low', 'medium', 'high'])
19
+ .nullable(),
20
+ overallStatus: zod_1.z.enum(['ok', 'warning', 'critical']),
21
+ activeAlertCount: zod_1.z.number(),
22
+ lastAlertDate: zod_1.z.string().datetime().nullable(),
23
+ dataQuality: zod_1.z.enum(['excellent', 'good', 'fair', 'poor']).nullable(),
24
+ cloudCover: zod_1.z.number().nullable(),
25
+ lastProcessedAt: zod_1.z.string().datetime(),
26
+ });
27
+ // NDVI Trend Data Point Schema
28
+ exports.ndviTrendDataPointSchema = zod_1.z.object({
29
+ time: zod_1.z.string().datetime(),
30
+ ndvi: zod_1.z.number().min(-1).max(1),
31
+ cloudCover: zod_1.z.number(),
32
+ });
33
+ // Weekly NDVI Stats Schema
34
+ exports.weeklyNDVIStatsSchema = zod_1.z.object({
35
+ week: zod_1.z.string().datetime(),
36
+ avgNdvi: zod_1.z.number(),
37
+ maxNdvi: zod_1.z.number(),
38
+ minNdvi: zod_1.z.number(),
39
+ });
40
+ // Field Alert Schema
41
+ exports.fieldAlertSchema = zod_1.z.object({
42
+ id: zod_1.z.string().uuid(),
43
+ fieldId: zod_1.z.string().uuid(),
44
+ fieldName: zod_1.z.string().optional(),
45
+ type: zod_1.z.string(),
46
+ severity: zod_1.z.enum(['low', 'medium', 'high', 'critical']),
47
+ title: zod_1.z.string(),
48
+ message: zod_1.z.string(),
49
+ recommendation: zod_1.z.string().nullable(),
50
+ status: zod_1.z.enum(['active', 'acknowledged', 'resolved']),
51
+ acknowledgedAt: zod_1.z.string().datetime().nullable(),
52
+ acknowledgedBy: zod_1.z.string().nullable(),
53
+ resolvedAt: zod_1.z.string().datetime().nullable(),
54
+ confidence: zod_1.z.number().min(0).max(1).nullable(),
55
+ generatedBy: zod_1.z.string(),
56
+ createdAt: zod_1.z.string().datetime(),
57
+ });
58
+ // Field Comparison Schema
59
+ exports.fieldComparisonSchema = zod_1.z.object({
60
+ fieldId: zod_1.z.string().uuid(),
61
+ fieldName: zod_1.z.string(),
62
+ avgNDVI: zod_1.z.number(),
63
+ avgHealthScore: zod_1.z.number(),
64
+ rank: zod_1.z.number(),
65
+ });
66
+ // Farm Monitoring Stats Schema
67
+ exports.farmMonitoringStatsSchema = zod_1.z.object({
68
+ totalFields: zod_1.z.number(),
69
+ healthyFields: zod_1.z.number(),
70
+ warningFields: zod_1.z.number(),
71
+ criticalFields: zod_1.z.number(),
72
+ avgNDVI: zod_1.z.number(),
73
+ totalActiveAlerts: zod_1.z.number(),
74
+ });
75
+ // Query Schemas
76
+ exports.ndviTrendQuerySchema = zod_1.z.object({
77
+ startDate: zod_1.z.string().datetime(),
78
+ endDate: zod_1.z.string().datetime(),
79
+ interval: zod_1.z.enum(['daily', 'weekly']).default('daily'),
80
+ });
81
+ exports.alertsQuerySchema = zod_1.z.object({
82
+ status: zod_1.z.enum(['active', 'acknowledged', 'resolved']).optional(),
83
+ });
84
+ // Response Schemas
85
+ exports.triggerAnalysisResponseSchema = zod_1.z.object({
86
+ message: zod_1.z.string(),
87
+ jobId: zod_1.z.string(),
88
+ });
89
+ exports.fieldMonitoringErrorResponseSchema = zod_1.z.object({
90
+ message: zod_1.z.string(),
91
+ code: zod_1.z.string().optional(),
92
+ });
@@ -121,7 +121,7 @@ export declare const createTaskAttributesSchema: z.ZodObject<{
121
121
  fieldId: z.ZodString;
122
122
  date: z.ZodString;
123
123
  status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["pending", "in-progress", "completed", "cancelled"]>>>;
124
- category: z.ZodOptional<z.ZodString>;
124
+ category: z.ZodString;
125
125
  inventoryItemId: z.ZodOptional<z.ZodString>;
126
126
  plannedQuantity: z.ZodOptional<z.ZodNumber>;
127
127
  assignedTo: z.ZodOptional<z.ZodString>;
@@ -130,8 +130,8 @@ export declare const createTaskAttributesSchema: z.ZodObject<{
130
130
  date: string;
131
131
  title: string;
132
132
  fieldId: string;
133
+ category: string;
133
134
  status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
134
- category?: string | undefined;
135
135
  inventoryItemId?: string | undefined;
136
136
  plannedQuantity?: number | undefined;
137
137
  assignedTo?: string | undefined;
@@ -140,8 +140,8 @@ export declare const createTaskAttributesSchema: z.ZodObject<{
140
140
  date: string;
141
141
  title: string;
142
142
  fieldId: string;
143
+ category: string;
143
144
  status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
144
- category?: string | undefined;
145
145
  inventoryItemId?: string | undefined;
146
146
  plannedQuantity?: number | undefined;
147
147
  assignedTo?: string | undefined;
@@ -205,7 +205,7 @@ export declare const createTaskSchema: z.ZodObject<{
205
205
  fieldId: z.ZodString;
206
206
  date: z.ZodString;
207
207
  status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["pending", "in-progress", "completed", "cancelled"]>>>;
208
- category: z.ZodOptional<z.ZodString>;
208
+ category: z.ZodString;
209
209
  inventoryItemId: z.ZodOptional<z.ZodString>;
210
210
  plannedQuantity: z.ZodOptional<z.ZodNumber>;
211
211
  assignedTo: z.ZodOptional<z.ZodString>;
@@ -214,8 +214,8 @@ export declare const createTaskSchema: z.ZodObject<{
214
214
  date: string;
215
215
  title: string;
216
216
  fieldId: string;
217
+ category: string;
217
218
  status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
218
- category?: string | undefined;
219
219
  inventoryItemId?: string | undefined;
220
220
  plannedQuantity?: number | undefined;
221
221
  assignedTo?: string | undefined;
@@ -224,8 +224,8 @@ export declare const createTaskSchema: z.ZodObject<{
224
224
  date: string;
225
225
  title: string;
226
226
  fieldId: string;
227
+ category: string;
227
228
  status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
228
- category?: string | undefined;
229
229
  inventoryItemId?: string | undefined;
230
230
  plannedQuantity?: number | undefined;
231
231
  assignedTo?: string | undefined;
@@ -237,8 +237,8 @@ export declare const createTaskSchema: z.ZodObject<{
237
237
  date: string;
238
238
  title: string;
239
239
  fieldId: string;
240
+ category: string;
240
241
  status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
241
- category?: string | undefined;
242
242
  inventoryItemId?: string | undefined;
243
243
  plannedQuantity?: number | undefined;
244
244
  assignedTo?: string | undefined;
@@ -250,8 +250,8 @@ export declare const createTaskSchema: z.ZodObject<{
250
250
  date: string;
251
251
  title: string;
252
252
  fieldId: string;
253
+ category: string;
253
254
  status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
254
- category?: string | undefined;
255
255
  inventoryItemId?: string | undefined;
256
256
  plannedQuantity?: number | undefined;
257
257
  assignedTo?: string | undefined;
@@ -44,7 +44,7 @@ exports.createTaskAttributesSchema = zod_1.z.object({
44
44
  fieldId: zod_1.z.string().uuid(),
45
45
  date: zod_1.z.string().datetime(),
46
46
  status: exports.taskStatusSchema.default('pending').optional(),
47
- category: zod_1.z.string().min(1).max(100).optional(), // Optional - will use default if not provided
47
+ category: zod_1.z.string().min(1).max(100), // Required - frontend should use default category if user doesn't select
48
48
  // Inventory linking
49
49
  inventoryItemId: zod_1.z.string().uuid().optional(),
50
50
  plannedQuantity: zod_1.z.number().positive().optional(),