@prodoctors/contracts 1.12.0 → 1.14.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,341 +1,344 @@
1
- syntax = "proto3";
2
-
3
- package inventory.v1;
4
-
5
- import "google/protobuf/timestamp.proto";
6
- import "common.proto";
7
- import "catalog.proto";
8
-
9
- enum ProductStatus {
10
- PRODUCT_STATUS_UNSPECIFIED = 0;
11
- PRODUCT_STATUS_ACTIVE = 1;
12
- PRODUCT_STATUS_INACTIVE = 2;
13
- }
14
-
15
- enum UnitType {
16
- UNIT_TYPE_UNSPECIFIED = 0;
17
- UNIT_TYPE_PIECE = 1;
18
- UNIT_TYPE_BOX = 2;
19
- UNIT_TYPE_BOTTLE = 3;
20
- UNIT_TYPE_PACK = 4;
21
- UNIT_TYPE_BLISTER = 5;
22
- UNIT_TYPE_TUBE = 6;
23
- UNIT_TYPE_AMPULE = 7;
24
- UNIT_TYPE_VIAL = 8;
25
- }
26
-
27
- enum ProductForm {
28
- PRODUCT_FORM_UNSPECIFIED = 0;
29
- PRODUCT_FORM_TABLET = 1;
30
- PRODUCT_FORM_CAPSULE = 2;
31
- PRODUCT_FORM_SYRUP = 3;
32
- PRODUCT_FORM_INJECTION = 4;
33
- PRODUCT_FORM_OINTMENT = 5;
34
- PRODUCT_FORM_CREAM = 6;
35
- PRODUCT_FORM_GEL = 7;
36
- PRODUCT_FORM_DROPS = 8;
37
- PRODUCT_FORM_SPRAY = 9;
38
- PRODUCT_FORM_POWDER = 10;
39
- PRODUCT_FORM_SOLUTION = 11;
40
- PRODUCT_FORM_SUPPOSITORY = 12;
41
- PRODUCT_FORM_OTHER = 13;
42
- }
43
-
44
- enum BatchStatus {
45
- BATCH_STATUS_UNSPECIFIED = 0;
46
- BATCH_STATUS_ACTIVE = 1;
47
- BATCH_STATUS_EXPIRED = 2;
48
- BATCH_STATUS_DEPLETED = 3;
49
- BATCH_STATUS_BLOCKED = 4;
50
- }
51
-
52
- enum StockMovementType {
53
- STOCK_MOVEMENT_TYPE_UNSPECIFIED = 0;
54
- STOCK_MOVEMENT_TYPE_IN = 1;
55
- STOCK_MOVEMENT_TYPE_OUT = 2;
56
- STOCK_MOVEMENT_TYPE_RETURN_IN = 3;
57
- STOCK_MOVEMENT_TYPE_RETURN_OUT = 4;
58
- STOCK_MOVEMENT_TYPE_WRITE_OFF = 5;
59
- STOCK_MOVEMENT_TYPE_ADJUSTMENT = 6;
60
- STOCK_MOVEMENT_TYPE_TRANSFER_OUT = 7;
61
- STOCK_MOVEMENT_TYPE_TRANSFER_IN = 8;
62
- }
63
-
64
- message Product {
65
- string id = 1;
66
- string name = 2;
67
- string sku = 3;
68
- optional string barcode = 4;
69
- optional string dosage = 5;
70
- optional string description = 6;
71
- ProductForm form = 7;
72
- UnitType unit = 8;
73
- bool requires_prescription = 9;
74
- ProductStatus status = 10;
75
- optional string brand_id = 11;
76
- optional string category_id = 12;
77
- optional string international_name_id = 13;
78
- optional string manufacturer_id = 14;
79
- string price = 15;
80
- optional string cost_price = 16;
81
- optional catalog.v1.Brand brand = 17;
82
- optional catalog.v1.Category category = 18;
83
- optional catalog.v1.InternationalName international_name = 19;
84
- optional catalog.v1.Manufacturer manufacturer = 20;
85
- google.protobuf.Timestamp created_at = 21;
86
- google.protobuf.Timestamp updated_at = 22;
87
- optional string image_url = 23;
88
- UnitType base_unit = 24;
89
- UnitType package_unit = 25;
90
- int32 units_per_package = 26;
91
- bool allow_fractional_sale = 27;
92
- optional string tax_mxik_code = 28;
93
- optional string tax_package_code = 29;
94
-
95
- // Mavjudlik (faqat so'ralganda to'ldiriladi — masalan web katalog ro'yxati).
96
- // offers_count = mahsulot mavjud bo'lgan dorixonalar soni; 0 bo'lsa sotuvda yo'q.
97
- optional int32 offers_count = 30;
98
- // Barcha dorixonalar bo'yicha jami mavjud miqdor (remaining - reserved).
99
- optional int32 available_quantity = 31;
100
- }
101
-
102
- message ProductBarcode {
103
- string id = 1;
104
- string product_id = 2;
105
- string barcode = 3;
106
- bool is_primary = 4;
107
- optional string package_type = 5;
108
- optional string note = 6;
109
- google.protobuf.Timestamp created_at = 7;
110
- google.protobuf.Timestamp updated_at = 8;
111
- }
112
-
113
- message ProductBatch {
114
- string id = 1;
115
- string product_id = 2;
116
- string branch_id = 3;
117
- string batch_number = 4;
118
- google.protobuf.Timestamp expiry_date = 5;
119
- optional google.protobuf.Timestamp manufacture_date = 6;
120
- string purchase_price = 7;
121
- string selling_price = 8;
122
- int32 initial_quantity = 9;
123
- int32 remaining_quantity = 10;
124
- BatchStatus status = 11;
125
- optional string purchase_item_id = 12;
126
- optional Product product = 13;
127
- google.protobuf.Timestamp created_at = 14;
128
- google.protobuf.Timestamp updated_at = 15;
129
- int32 purchase_package_quantity = 16;
130
- int32 units_per_package = 17;
131
- optional string selling_price_per_base_unit = 18;
132
- int32 reserved_quantity = 19;
133
- }
134
-
135
- message StockMovement {
136
- string id = 1;
137
- string branch_id = 2;
138
- string product_id = 3;
139
- string product_batch_id = 4;
140
- StockMovementType type = 5;
141
- int32 quantity = 6;
142
- int32 balance_before = 7;
143
- int32 balance_after = 8;
144
- optional string reference_type = 9;
145
- optional string reference_id = 10;
146
- optional string performed_by_id = 11;
147
- optional string note = 12;
148
- google.protobuf.Timestamp created_at = 13;
149
- }
150
-
151
- message CreateProductRequest {
152
- string name = 1;
153
- string sku = 2;
154
- optional string barcode = 3;
155
- optional string dosage = 4;
156
- optional string description = 5;
157
- ProductForm form = 6;
158
- UnitType unit = 7;
159
- optional bool requires_prescription = 8;
160
- optional ProductStatus status = 9;
161
- optional string brand_id = 10;
162
- optional string category_id = 11;
163
- optional string international_name_id = 12;
164
- optional string manufacturer_id = 13;
165
- string price = 14;
166
- optional string cost_price = 15;
167
- optional string image_url = 16;
168
- optional UnitType base_unit = 17;
169
- optional UnitType package_unit = 18;
170
- optional int32 units_per_package = 19;
171
- optional bool allow_fractional_sale = 20;
172
- optional string tax_mxik_code = 21;
173
- optional string tax_package_code = 22;
174
- }
175
-
176
- message UpdateProductRequest {
177
- string id = 1;
178
- optional string name = 2;
179
- optional string sku = 3;
180
- optional string barcode = 4;
181
- optional string dosage = 5;
182
- optional string description = 6;
183
- optional ProductForm form = 7;
184
- optional UnitType unit = 8;
185
- optional bool requires_prescription = 9;
186
- optional ProductStatus status = 10;
187
- optional string brand_id = 11;
188
- optional string category_id = 12;
189
- optional string international_name_id = 13;
190
- optional string manufacturer_id = 14;
191
- optional string price = 15;
192
- optional string cost_price = 16;
193
- optional string image_url = 17;
194
- optional UnitType base_unit = 18;
195
- optional UnitType package_unit = 19;
196
- optional int32 units_per_package = 20;
197
- optional bool allow_fractional_sale = 21;
198
- optional string tax_mxik_code = 22;
199
- optional string tax_package_code = 23;
200
- }
201
-
202
- message ListProductsRequest {
203
- common.v1.PaginationRequest pagination = 1;
204
- optional string search = 2;
205
- optional string brand_id = 3;
206
- optional string category_id = 4;
207
- optional string international_name_id = 5;
208
- optional string manufacturer_id = 6;
209
- optional ProductStatus status = 7;
210
- // Faqat biror dorixonada mavjud (remaining - reserved > 0) mahsulotlar.
211
- optional bool in_stock_only = 8;
212
- }
213
-
214
- message ListProductsResponse {
215
- repeated Product items = 1;
216
- common.v1.PaginationMeta meta = 2;
217
- }
218
-
219
- message CreateProductBarcodeRequest {
220
- string product_id = 1;
221
- string barcode = 2;
222
- optional bool is_primary = 3;
223
- optional string package_type = 4;
224
- optional string note = 5;
225
- }
226
-
227
- message UpdateProductBarcodeRequest {
228
- string id = 1;
229
- optional string barcode = 2;
230
- optional bool is_primary = 3;
231
- optional string package_type = 4;
232
- optional string note = 5;
233
- }
234
-
235
- message ListProductBarcodesResponse {
236
- repeated ProductBarcode items = 1;
237
- }
238
-
239
- message CreateProductBatchRequest {
240
- string product_id = 1;
241
- string branch_id = 2;
242
- string batch_number = 3;
243
- google.protobuf.Timestamp expiry_date = 4;
244
- optional google.protobuf.Timestamp manufacture_date = 5;
245
- string purchase_price = 6;
246
- string selling_price = 7;
247
- int32 initial_quantity = 8;
248
- optional int32 remaining_quantity = 9;
249
- optional BatchStatus status = 10;
250
- optional string purchase_item_id = 11;
251
- optional int32 purchase_package_quantity = 12;
252
- optional int32 units_per_package = 13;
253
- optional string selling_price_per_base_unit = 14;
254
- }
255
-
256
- message UpdateProductBatchRequest {
257
- string id = 1;
258
- optional string batch_number = 2;
259
- optional google.protobuf.Timestamp expiry_date = 3;
260
- optional google.protobuf.Timestamp manufacture_date = 4;
261
- optional string purchase_price = 5;
262
- optional string selling_price = 6;
263
- optional int32 initial_quantity = 7;
264
- optional int32 remaining_quantity = 8;
265
- optional BatchStatus status = 9;
266
- optional int32 purchase_package_quantity = 10;
267
- optional int32 units_per_package = 11;
268
- optional string selling_price_per_base_unit = 12;
269
- }
270
-
271
- message ListProductBatchesRequest {
272
- common.v1.PaginationRequest pagination = 1;
273
- optional string branch_id = 2;
274
- optional string product_id = 3;
275
- optional string batch_number = 4;
276
- optional BatchStatus status = 5;
277
- optional bool low_stock_only = 6;
278
- optional bool expiring_soon_only = 7;
279
- }
280
-
281
- message ListProductBatchesResponse {
282
- repeated ProductBatch items = 1;
283
- common.v1.PaginationMeta meta = 2;
284
- }
285
-
286
- message CreateStockMovementRequest {
287
- string branch_id = 1;
288
- string product_id = 2;
289
- string product_batch_id = 3;
290
- StockMovementType type = 4;
291
- int32 quantity = 5;
292
- int32 balance_before = 6;
293
- int32 balance_after = 7;
294
- optional string reference_type = 8;
295
- optional string reference_id = 9;
296
- optional string performed_by_id = 10;
297
- optional string note = 11;
298
- }
299
-
300
- message ListStockMovementsRequest {
301
- common.v1.PaginationRequest pagination = 1;
302
- optional string branch_id = 2;
303
- optional string product_id = 3;
304
- optional string product_batch_id = 4;
305
- optional StockMovementType type = 5;
306
- }
307
-
308
- message ListStockMovementsResponse {
309
- repeated StockMovement items = 1;
310
- common.v1.PaginationMeta meta = 2;
311
- }
312
-
313
- service ProductService {
314
- rpc CreateProduct(CreateProductRequest) returns (Product);
315
- rpc UpdateProduct(UpdateProductRequest) returns (Product);
316
- rpc GetProductById(common.v1.IdRequest) returns (Product);
317
- rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
318
- rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
319
- }
320
-
321
- service ProductBarcodeService {
322
- rpc CreateProductBarcode(CreateProductBarcodeRequest) returns (ProductBarcode);
323
- rpc UpdateProductBarcode(UpdateProductBarcodeRequest) returns (ProductBarcode);
324
- rpc GetProductBarcodeById(common.v1.IdRequest) returns (ProductBarcode);
325
- rpc ListProductBarcodes(common.v1.IdRequest) returns (ListProductBarcodesResponse);
326
- rpc DeleteProductBarcode(common.v1.IdRequest) returns (common.v1.BoolResponse);
327
- }
328
-
329
- service ProductBatchService {
330
- rpc CreateProductBatch(CreateProductBatchRequest) returns (ProductBatch);
331
- rpc UpdateProductBatch(UpdateProductBatchRequest) returns (ProductBatch);
332
- rpc GetProductBatchById(common.v1.IdRequest) returns (ProductBatch);
333
- rpc ListProductBatches(ListProductBatchesRequest) returns (ListProductBatchesResponse);
334
- rpc DeleteProductBatch(common.v1.IdRequest) returns (common.v1.BoolResponse);
335
- }
336
-
337
- service StockMovementService {
338
- rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
339
- rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
340
- rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
341
- }
1
+ syntax = "proto3";
2
+
3
+ package inventory.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+ import "catalog.proto";
8
+
9
+ enum ProductStatus {
10
+ PRODUCT_STATUS_UNSPECIFIED = 0;
11
+ PRODUCT_STATUS_ACTIVE = 1;
12
+ PRODUCT_STATUS_INACTIVE = 2;
13
+ }
14
+
15
+ enum UnitType {
16
+ UNIT_TYPE_UNSPECIFIED = 0;
17
+ UNIT_TYPE_PIECE = 1;
18
+ UNIT_TYPE_BOX = 2;
19
+ UNIT_TYPE_BOTTLE = 3;
20
+ UNIT_TYPE_PACK = 4;
21
+ UNIT_TYPE_BLISTER = 5;
22
+ UNIT_TYPE_TUBE = 6;
23
+ UNIT_TYPE_AMPULE = 7;
24
+ UNIT_TYPE_VIAL = 8;
25
+ }
26
+
27
+ enum ProductForm {
28
+ PRODUCT_FORM_UNSPECIFIED = 0;
29
+ PRODUCT_FORM_TABLET = 1;
30
+ PRODUCT_FORM_CAPSULE = 2;
31
+ PRODUCT_FORM_SYRUP = 3;
32
+ PRODUCT_FORM_INJECTION = 4;
33
+ PRODUCT_FORM_OINTMENT = 5;
34
+ PRODUCT_FORM_CREAM = 6;
35
+ PRODUCT_FORM_GEL = 7;
36
+ PRODUCT_FORM_DROPS = 8;
37
+ PRODUCT_FORM_SPRAY = 9;
38
+ PRODUCT_FORM_POWDER = 10;
39
+ PRODUCT_FORM_SOLUTION = 11;
40
+ PRODUCT_FORM_SUPPOSITORY = 12;
41
+ PRODUCT_FORM_OTHER = 13;
42
+ }
43
+
44
+ enum BatchStatus {
45
+ BATCH_STATUS_UNSPECIFIED = 0;
46
+ BATCH_STATUS_ACTIVE = 1;
47
+ BATCH_STATUS_EXPIRED = 2;
48
+ BATCH_STATUS_DEPLETED = 3;
49
+ BATCH_STATUS_BLOCKED = 4;
50
+ }
51
+
52
+ enum StockMovementType {
53
+ STOCK_MOVEMENT_TYPE_UNSPECIFIED = 0;
54
+ STOCK_MOVEMENT_TYPE_IN = 1;
55
+ STOCK_MOVEMENT_TYPE_OUT = 2;
56
+ STOCK_MOVEMENT_TYPE_RETURN_IN = 3;
57
+ STOCK_MOVEMENT_TYPE_RETURN_OUT = 4;
58
+ STOCK_MOVEMENT_TYPE_WRITE_OFF = 5;
59
+ STOCK_MOVEMENT_TYPE_ADJUSTMENT = 6;
60
+ STOCK_MOVEMENT_TYPE_TRANSFER_OUT = 7;
61
+ STOCK_MOVEMENT_TYPE_TRANSFER_IN = 8;
62
+ }
63
+
64
+ message Product {
65
+ string id = 1;
66
+ string name = 2;
67
+ string sku = 3;
68
+ optional string barcode = 4;
69
+ optional string dosage = 5;
70
+ optional string description = 6;
71
+ ProductForm form = 7;
72
+ UnitType unit = 8;
73
+ bool requires_prescription = 9;
74
+ ProductStatus status = 10;
75
+ optional string brand_id = 11;
76
+ optional string category_id = 12;
77
+ optional string international_name_id = 13;
78
+ optional string manufacturer_id = 14;
79
+ string price = 15;
80
+ optional string cost_price = 16;
81
+ optional catalog.v1.Brand brand = 17;
82
+ optional catalog.v1.Category category = 18;
83
+ optional catalog.v1.InternationalName international_name = 19;
84
+ optional catalog.v1.Manufacturer manufacturer = 20;
85
+ google.protobuf.Timestamp created_at = 21;
86
+ google.protobuf.Timestamp updated_at = 22;
87
+ optional string image_url = 23;
88
+ UnitType base_unit = 24;
89
+ UnitType package_unit = 25;
90
+ int32 units_per_package = 26;
91
+ bool allow_fractional_sale = 27;
92
+ optional string tax_mxik_code = 28;
93
+ optional string tax_package_code = 29;
94
+
95
+ // Mavjudlik (faqat so'ralganda to'ldiriladi — masalan web katalog ro'yxati).
96
+ // offers_count = mahsulot mavjud bo'lgan dorixonalar soni; 0 bo'lsa sotuvda yo'q.
97
+ optional int32 offers_count = 30;
98
+ // Barcha dorixonalar bo'yicha jami mavjud miqdor (remaining - reserved).
99
+ optional int32 available_quantity = 31;
100
+ }
101
+
102
+ message ProductBarcode {
103
+ string id = 1;
104
+ string product_id = 2;
105
+ string barcode = 3;
106
+ bool is_primary = 4;
107
+ optional string package_type = 5;
108
+ optional string note = 6;
109
+ google.protobuf.Timestamp created_at = 7;
110
+ google.protobuf.Timestamp updated_at = 8;
111
+ }
112
+
113
+ message ProductBatch {
114
+ string id = 1;
115
+ string product_id = 2;
116
+ string branch_id = 3;
117
+ string batch_number = 4;
118
+ google.protobuf.Timestamp expiry_date = 5;
119
+ optional google.protobuf.Timestamp manufacture_date = 6;
120
+ string purchase_price = 7;
121
+ string selling_price = 8;
122
+ int32 initial_quantity = 9;
123
+ int32 remaining_quantity = 10;
124
+ BatchStatus status = 11;
125
+ optional string purchase_item_id = 12;
126
+ optional Product product = 13;
127
+ google.protobuf.Timestamp created_at = 14;
128
+ google.protobuf.Timestamp updated_at = 15;
129
+ int32 purchase_package_quantity = 16;
130
+ int32 units_per_package = 17;
131
+ optional string selling_price_per_base_unit = 18;
132
+ int32 reserved_quantity = 19;
133
+ }
134
+
135
+ message StockMovement {
136
+ string id = 1;
137
+ string branch_id = 2;
138
+ string product_id = 3;
139
+ string product_batch_id = 4;
140
+ StockMovementType type = 5;
141
+ int32 quantity = 6;
142
+ int32 balance_before = 7;
143
+ int32 balance_after = 8;
144
+ optional string reference_type = 9;
145
+ optional string reference_id = 10;
146
+ optional string performed_by_id = 11;
147
+ optional string note = 12;
148
+ google.protobuf.Timestamp created_at = 13;
149
+ }
150
+
151
+ message CreateProductRequest {
152
+ string name = 1;
153
+ string sku = 2;
154
+ optional string barcode = 3;
155
+ optional string dosage = 4;
156
+ optional string description = 5;
157
+ ProductForm form = 6;
158
+ UnitType unit = 7;
159
+ optional bool requires_prescription = 8;
160
+ optional ProductStatus status = 9;
161
+ optional string brand_id = 10;
162
+ optional string category_id = 11;
163
+ optional string international_name_id = 12;
164
+ optional string manufacturer_id = 13;
165
+ string price = 14;
166
+ optional string cost_price = 15;
167
+ optional string image_url = 16;
168
+ optional UnitType base_unit = 17;
169
+ optional UnitType package_unit = 18;
170
+ optional int32 units_per_package = 19;
171
+ optional bool allow_fractional_sale = 20;
172
+ optional string tax_mxik_code = 21;
173
+ optional string tax_package_code = 22;
174
+ }
175
+
176
+ message UpdateProductRequest {
177
+ string id = 1;
178
+ optional string name = 2;
179
+ optional string sku = 3;
180
+ optional string barcode = 4;
181
+ optional string dosage = 5;
182
+ optional string description = 6;
183
+ optional ProductForm form = 7;
184
+ optional UnitType unit = 8;
185
+ optional bool requires_prescription = 9;
186
+ optional ProductStatus status = 10;
187
+ optional string brand_id = 11;
188
+ optional string category_id = 12;
189
+ optional string international_name_id = 13;
190
+ optional string manufacturer_id = 14;
191
+ optional string price = 15;
192
+ optional string cost_price = 16;
193
+ optional string image_url = 17;
194
+ optional UnitType base_unit = 18;
195
+ optional UnitType package_unit = 19;
196
+ optional int32 units_per_package = 20;
197
+ optional bool allow_fractional_sale = 21;
198
+ optional string tax_mxik_code = 22;
199
+ optional string tax_package_code = 23;
200
+ }
201
+
202
+ message ListProductsRequest {
203
+ common.v1.PaginationRequest pagination = 1;
204
+ optional string search = 2;
205
+ optional string brand_id = 3;
206
+ optional string category_id = 4;
207
+ optional string international_name_id = 5;
208
+ optional string manufacturer_id = 6;
209
+ optional ProductStatus status = 7;
210
+ // Faqat biror dorixonada mavjud (remaining - reserved > 0) mahsulotlar.
211
+ optional bool in_stock_only = 8;
212
+ // Yashirmaydi, lekin sotuvda bor mahsulotlarni ro'yxat boshiga chiqaradi.
213
+ // Sahifalash saqlanadi: avval mavjudlar, tugagach qolganlari.
214
+ optional bool prioritize_in_stock = 9;
215
+ }
216
+
217
+ message ListProductsResponse {
218
+ repeated Product items = 1;
219
+ common.v1.PaginationMeta meta = 2;
220
+ }
221
+
222
+ message CreateProductBarcodeRequest {
223
+ string product_id = 1;
224
+ string barcode = 2;
225
+ optional bool is_primary = 3;
226
+ optional string package_type = 4;
227
+ optional string note = 5;
228
+ }
229
+
230
+ message UpdateProductBarcodeRequest {
231
+ string id = 1;
232
+ optional string barcode = 2;
233
+ optional bool is_primary = 3;
234
+ optional string package_type = 4;
235
+ optional string note = 5;
236
+ }
237
+
238
+ message ListProductBarcodesResponse {
239
+ repeated ProductBarcode items = 1;
240
+ }
241
+
242
+ message CreateProductBatchRequest {
243
+ string product_id = 1;
244
+ string branch_id = 2;
245
+ string batch_number = 3;
246
+ google.protobuf.Timestamp expiry_date = 4;
247
+ optional google.protobuf.Timestamp manufacture_date = 5;
248
+ string purchase_price = 6;
249
+ string selling_price = 7;
250
+ int32 initial_quantity = 8;
251
+ optional int32 remaining_quantity = 9;
252
+ optional BatchStatus status = 10;
253
+ optional string purchase_item_id = 11;
254
+ optional int32 purchase_package_quantity = 12;
255
+ optional int32 units_per_package = 13;
256
+ optional string selling_price_per_base_unit = 14;
257
+ }
258
+
259
+ message UpdateProductBatchRequest {
260
+ string id = 1;
261
+ optional string batch_number = 2;
262
+ optional google.protobuf.Timestamp expiry_date = 3;
263
+ optional google.protobuf.Timestamp manufacture_date = 4;
264
+ optional string purchase_price = 5;
265
+ optional string selling_price = 6;
266
+ optional int32 initial_quantity = 7;
267
+ optional int32 remaining_quantity = 8;
268
+ optional BatchStatus status = 9;
269
+ optional int32 purchase_package_quantity = 10;
270
+ optional int32 units_per_package = 11;
271
+ optional string selling_price_per_base_unit = 12;
272
+ }
273
+
274
+ message ListProductBatchesRequest {
275
+ common.v1.PaginationRequest pagination = 1;
276
+ optional string branch_id = 2;
277
+ optional string product_id = 3;
278
+ optional string batch_number = 4;
279
+ optional BatchStatus status = 5;
280
+ optional bool low_stock_only = 6;
281
+ optional bool expiring_soon_only = 7;
282
+ }
283
+
284
+ message ListProductBatchesResponse {
285
+ repeated ProductBatch items = 1;
286
+ common.v1.PaginationMeta meta = 2;
287
+ }
288
+
289
+ message CreateStockMovementRequest {
290
+ string branch_id = 1;
291
+ string product_id = 2;
292
+ string product_batch_id = 3;
293
+ StockMovementType type = 4;
294
+ int32 quantity = 5;
295
+ int32 balance_before = 6;
296
+ int32 balance_after = 7;
297
+ optional string reference_type = 8;
298
+ optional string reference_id = 9;
299
+ optional string performed_by_id = 10;
300
+ optional string note = 11;
301
+ }
302
+
303
+ message ListStockMovementsRequest {
304
+ common.v1.PaginationRequest pagination = 1;
305
+ optional string branch_id = 2;
306
+ optional string product_id = 3;
307
+ optional string product_batch_id = 4;
308
+ optional StockMovementType type = 5;
309
+ }
310
+
311
+ message ListStockMovementsResponse {
312
+ repeated StockMovement items = 1;
313
+ common.v1.PaginationMeta meta = 2;
314
+ }
315
+
316
+ service ProductService {
317
+ rpc CreateProduct(CreateProductRequest) returns (Product);
318
+ rpc UpdateProduct(UpdateProductRequest) returns (Product);
319
+ rpc GetProductById(common.v1.IdRequest) returns (Product);
320
+ rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
321
+ rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
322
+ }
323
+
324
+ service ProductBarcodeService {
325
+ rpc CreateProductBarcode(CreateProductBarcodeRequest) returns (ProductBarcode);
326
+ rpc UpdateProductBarcode(UpdateProductBarcodeRequest) returns (ProductBarcode);
327
+ rpc GetProductBarcodeById(common.v1.IdRequest) returns (ProductBarcode);
328
+ rpc ListProductBarcodes(common.v1.IdRequest) returns (ListProductBarcodesResponse);
329
+ rpc DeleteProductBarcode(common.v1.IdRequest) returns (common.v1.BoolResponse);
330
+ }
331
+
332
+ service ProductBatchService {
333
+ rpc CreateProductBatch(CreateProductBatchRequest) returns (ProductBatch);
334
+ rpc UpdateProductBatch(UpdateProductBatchRequest) returns (ProductBatch);
335
+ rpc GetProductBatchById(common.v1.IdRequest) returns (ProductBatch);
336
+ rpc ListProductBatches(ListProductBatchesRequest) returns (ListProductBatchesResponse);
337
+ rpc DeleteProductBatch(common.v1.IdRequest) returns (common.v1.BoolResponse);
338
+ }
339
+
340
+ service StockMovementService {
341
+ rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
342
+ rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
343
+ rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
344
+ }