TiantingDeliveryRuleService.proto 27.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945
syntax = "proto3";

option java_multiple_files = true;
option java_package = "com.infoloop.tianting.deliveryruleservice";
option java_outer_classname = "DeliveryRuleServiceProto";
option objc_class_prefix = "OP";

package com.infoloop.tianting.deliveryruleservice;

service TiantingDeliveryRuleServiceRpc {
  rpc GetClientLabelById (GetClientLabelByIdRpcRequest) returns (GetClientLabelByIdRpcResponse) {}
  rpc GetClientLabelsByIds (GetClientLabelsByIdsRpcRequest) returns (GetClientLabelsByIdsRpcResponse) {}
  rpc GetAllClientLabels (GetAllClientLabelsRpcRequest) returns (GetAllClientLabelsRpcResponse) {}
  rpc QueryClientLabelsByCondition (QueryClientLabelsByConditionRpcRequest) returns (QueryClientLabelsByConditionRpcResponse) {}
  rpc CreateClientLabel (CreateClientLabelRpcRequest) returns (CreateClientLabelRpcResponse) {}
  rpc BatchCreateClientLabels (BatchCreateClientLabelsRpcRequest) returns (BatchCreateClientLabelsRpcResponse) {}
  rpc UpdateClientLabel (UpdateClientLabelRpcRequest) returns (UpdateClientLabelRpcResponse) {}
  rpc BatchUpdateClientLabels (BatchUpdateClientLabelsRpcRequest) returns (BatchUpdateClientLabelsRpcResponse) {}
  rpc DeleteClientLabelsByIds (DeleteClientLabelsByIdsRpcRequest) returns (DeleteClientLabelsRpcResponse) {}

  // 根据类型获取默认标签
  rpc GetDefaultClientLabelByType (GetDefaultClientLabelByTypeRpcRequest) returns (GetDefaultClientLabelByTypeRpcResponse) {}
  // 根据类型和门店Id获取标签
  rpc GetClientLabelByStallIdAndType (GetClientLabelByStallIdAndTypeRpcRequest) returns (GetClientLabelByStallIdAndTypeRpcResponse) {}

  rpc GetClientLabelStallRefById (GetClientLabelStallRefByIdRpcRequest) returns (GetClientLabelStallRefByIdRpcResponse) {}
  rpc GetClientLabelStallRefsByIds (GetClientLabelStallRefsByIdsRpcRequest) returns (GetClientLabelStallRefsByIdsRpcResponse) {}
  rpc QueryClientLabelStallRefsByCondition (QueryClientLabelStallRefsByConditionRpcRequest) returns (QueryClientLabelStallRefsByConditionRpcResponse) {}
  rpc CreateClientLabelStallRef (CreateClientLabelStallRefRpcRequest) returns (CreateClientLabelStallRefRpcResponse) {}
  rpc BatchCreateClientLabelStallRefs (BatchCreateClientLabelStallRefsRpcRequest) returns (BatchCreateClientLabelStallRefsRpcResponse) {}
  rpc DeleteClientLabelStallRefsByIds (DeleteClientLabelStallRefsByIdsRpcRequest) returns (DeleteClientLabelStallRefsRpcResponse) {}
  rpc DeleteClientLabelStallRefsByLabelIdAndStallIds (DeleteClientLabelStallRefsByLabelIdAndStallIdsRpcRequest) returns (DeleteClientLabelStallRefsByLabelIdAndStallIdsRpcResponse) {}
  //门店批量绑定地区标签
  rpc BatchUpdateClientLabelByDistrictIds (BatchUpdateClientLabelByDistrictIdsRpcRequest) returns (BatchUpdateClientLabelByDistrictIdsRpcResponse) {}

  rpc GetClientLabelDistrictRefById (GetClientLabelDistrictRefByIdRpcRequest) returns (GetClientLabelDistrictRefByIdRpcResponse) {}
  rpc GetClientLabelDistrictRefsByIds (GetClientLabelDistrictRefsByIdsRpcRequest) returns (GetClientLabelDistrictRefsByIdsRpcResponse) {}
  rpc QueryClientLabelDistrictRefsByCondition (QueryClientLabelDistrictRefsByConditionRpcRequest) returns (QueryClientLabelDistrictRefsByConditionRpcResponse) {}
  rpc CreateClientLabelDistrictRef (CreateClientLabelDistrictRefRpcRequest) returns (CreateClientLabelDistrictRefRpcResponse) {}
  rpc BatchCreateClientLabelDistrictRefs (BatchCreateClientLabelDistrictRefsRpcRequest) returns (BatchCreateClientLabelDistrictRefsRpcResponse) {}
  rpc DeleteClientLabelDistrictRefsByIds (DeleteClientLabelDistrictRefsByIdsRpcRequest) returns (DeleteClientLabelDistrictRefsRpcResponse) {}


  rpc GetDeliveryTemplateById (GetDeliveryTemplateByIdRpcRequest) returns (GetDeliveryTemplateByIdRpcResponse) {}
  rpc GetDeliveryTemplatesByIds (GetDeliveryTemplatesByIdsRpcRequest) returns (GetDeliveryTemplatesByIdsRpcResponse) {}
  rpc QueryDeliveryTemplatesByCondition (QueryDeliveryTemplatesByConditionRpcRequest) returns (QueryDeliveryTemplatesByConditionRpcResponse) {}
  rpc CreateDeliveryTemplate (CreateDeliveryTemplateRpcRequest) returns (CreateDeliveryTemplateRpcResponse) {}
  rpc UpdateDeliveryTemplate (UpdateDeliveryTemplateRpcRequest) returns (UpdateDeliveryTemplateRpcResponse) {}
  rpc DeleteDeliveryTemplatesByIds (DeleteDeliveryTemplatesByIdsRpcRequest) returns (DeleteDeliveryTemplatesRpcResponse) {}
  // 根据供应商或仓库Ids 获取运费模板
  rpc GetDeliveryTemplatesBySupplierIds (GetDeliveryTemplatesBySupplierIdsRpcRequest) returns (GetDeliveryTemplatesBySupplierIdsRpcResponse) {}
  // 根据模板类型获取默认的模板和规则
  rpc GetDefaultDeliveryTemplateAndRule (GetDefaultDeliveryTemplateAndRuleRpcRequest) returns (GetDefaultDeliveryTemplateAndRuleRpcResponse) {}
  // 获取门店的所有供应商/仓库的配送规则
  rpc GetStallDeliveryRuleConfig (GetStallDeliveryRuleConfigRpcRequest) returns (GetStallDeliveryRuleConfigRpcResponse) {}
  // 根据供应商或仓库Ids 获取门店的配送规则
  rpc GetStallDeliveryRuleConfigBySupplierIds (GetStallDeliveryRuleConfigBySupplierIdsRpcRequest) returns (GetStallDeliveryRuleConfigBySupplierIdsRpcResponse) {}
  // 根据供应商或仓库Ids 获取门店的运费规则
  rpc GetStallFreightRuleConfigBySupplierIds (GetStallFreightRuleConfigBySupplierIdsRpcRequest) returns (GetStallFreightRuleConfigBySupplierIdsRpcResponse) {}

  rpc GetDeliveryTemplateSupplierRefById (GetDeliveryTemplateSupplierRefByIdRpcRequest) returns (GetDeliveryTemplateSupplierRefByIdRpcResponse) {}
  rpc GetDeliveryTemplateSupplierRefsByIds (GetDeliveryTemplateSupplierRefsByIdsRpcRequest) returns (GetDeliveryTemplateSupplierRefsByIdsRpcResponse) {}
  rpc QueryDeliveryTemplateSupplierRefsByCondition (QueryDeliveryTemplateSupplierRefsByConditionRpcRequest) returns (QueryDeliveryTemplateSupplierRefsByConditionRpcResponse) {}
  rpc CreateDeliveryTemplateSupplierRef (CreateDeliveryTemplateSupplierRefRpcRequest) returns (CreateDeliveryTemplateSupplierRefRpcResponse) {}
  rpc BatchCreateDeliveryTemplateSupplierRefs (BatchCreateDeliveryTemplateSupplierRefsRpcRequest) returns (BatchCreateDeliveryTemplateSupplierRefsRpcResponse) {}
  rpc DeleteDeliveryTemplateSupplierRefsByIds (DeleteDeliveryTemplateSupplierRefsByIdsRpcRequest) returns (DeleteDeliveryTemplateSupplierRefsRpcResponse) {}

  rpc GetDeliveryRuleById (GetDeliveryRuleByIdRpcRequest) returns (GetDeliveryRuleByIdRpcResponse) {}
  rpc GetDeliveryRulesByIds (GetDeliveryRulesByIdsRpcRequest) returns (GetDeliveryRulesByIdsRpcResponse) {}
  rpc QueryDeliveryRulesByCondition (QueryDeliveryRulesByConditionRpcRequest) returns (QueryDeliveryRulesByConditionRpcResponse) {}
  rpc CreateDeliveryRule (CreateDeliveryRuleRpcRequest) returns (CreateDeliveryRuleRpcResponse) {}
  rpc BatchCreateDeliveryRules (BatchCreateDeliveryRulesRpcRequest) returns (BatchCreateDeliveryRulesRpcResponse) {}
  rpc UpdateDeliveryRule (UpdateDeliveryRuleRpcRequest) returns (UpdateDeliveryRuleRpcResponse) {}
  rpc BatchUpdateDeliveryRules (BatchUpdateDeliveryRulesRpcRequest) returns (BatchUpdateDeliveryRulesRpcResponse) {}
  rpc DeleteDeliveryRulesByIds (DeleteDeliveryRulesByIdsRpcRequest) returns (DeleteDeliveryRulesRpcResponse) {}

  rpc GetDeliveryRuleLabelRefById (GetDeliveryRuleLabelRefByIdRpcRequest) returns (GetDeliveryRuleLabelRefByIdRpcResponse) {}
  rpc GetDeliveryRuleLabelRefsByIds (GetDeliveryRuleLabelRefsByIdsRpcRequest) returns (GetDeliveryRuleLabelRefsByIdsRpcResponse) {}
  rpc QueryDeliveryRuleLabelRefsByCondition (QueryDeliveryRuleLabelRefsByConditionRpcRequest) returns (QueryDeliveryRuleLabelRefsByConditionRpcResponse) {}
  rpc CreateDeliveryRuleLabelRef (CreateDeliveryRuleLabelRefRpcRequest) returns (CreateDeliveryRuleLabelRefRpcResponse) {}
  rpc BatchCreateDeliveryRuleLabelRefs (BatchCreateDeliveryRuleLabelRefsRpcRequest) returns (BatchCreateDeliveryRuleLabelRefsRpcResponse) {}
  rpc DeleteDeliveryRuleLabelRefsByIds (DeleteDeliveryRuleLabelRefsByIdsRpcRequest) returns (DeleteDeliveryRuleLabelRefsRpcResponse) {}
}

enum ClientLabelTypeEnum {
  CLIENT_LABEL_TYPE_UNKNOWN = 0;
  CLIENT_LABEL_TYPE_DELIVERY = 1;
  CLIENT_LABEL_TYPE_ORDINARY = 2;
  CLIENT_LABEL_TYPE_DISTRICT = 3;
  CLIENT_LABEL_TYPE_CECOMMEND = 4; // 推荐标签
  CLIENT_LABEL_TYPE_TASTE = 5; // 口味标签
  CLIENT_LABEL_TYPE_EFFICACY = 6; // 功效标签
  CLIENT_LABEL_TYPE_DOCTOR = 7; // 医嘱标签
  CLIENT_LABEL_TYPE_AVOID =8;
  CLIENT_LABEL_TYPE_ALLERGENS =9; // 过敏源

}
enum ClientDishLabelStatusEnum {
  UNKNOWN_LABEL_STATUS = 0;
  ENABLE_LABEL_STATUS = 1; // 启用
  DEACTIVATE_LABEL_STATUS = 2; //停用
}
message SingleClientLabelRpcResponse {
  int32 id = 1;
  int32 enterpriseId = 2;
  string code = 3;
  string name = 4;
  ClientLabelTypeEnum type = 5;
  bool isDefault = 6;
  string remark = 7;
  int32 createdBy = 8;
  int64 createdAt = 9;
  int32 creationSource = 10;
  int32 updatedBy = 11;
  int64 updatedAt = 12;
  int32 updateSource = 13;
  bool isDeleted = 14;
  ClientDishLabelStatusEnum status =15;
}

message GetClientLabelByIdRpcRequest {
  int32 id = 1;
  int32 enterpriseId = 2;
  bool includeDeleted = 3;
}

message GetClientLabelByIdRpcResponse {
  SingleClientLabelRpcResponse response = 1;
}

message GetClientLabelsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
  bool includeDeleted = 3;
}

message GetClientLabelsByIdsRpcResponse {
  repeated SingleClientLabelRpcResponse responses = 1;
}

message GetAllClientLabelsRpcRequest {
  int32 enterpriseId = 1;
  bool includeDeleted = 2;
}

message GetAllClientLabelsRpcResponse {
  repeated SingleClientLabelRpcResponse responses = 1;
}

message QueryClientLabelsByConditionRpcRequest {
  int32 enterpriseId = 1;
  bool shouldFilterCode = 2;
  string code = 3;
  bool shouldFilterName = 4;
  string name = 5;
  bool shouldFilterType = 6;
  ClientLabelTypeEnum type = 7;
  bool shouldFilterIsDefault = 8;
  bool isDefault = 9;
  bool includeDeleted = 10;
  bool shouldFilterTypes = 11;
  repeated ClientLabelTypeEnum types = 12;
  bool shouldFilterCodes = 13;
  repeated string codes = 14;

}

message QueryClientLabelsByConditionRpcResponse {
  repeated SingleClientLabelRpcResponse responses = 1;
}

message ClientLabelCreation{
  string code = 1;
  string name = 2;
  ClientLabelTypeEnum type = 3;
  bool isDefault = 4;
  string remark = 5;
  ClientDishLabelStatusEnum status =6;
}

message CreateClientLabelRpcRequest {
  ClientLabelCreation creation = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message CreateClientLabelRpcResponse {
  int32 id = 1;
  bool isCreated = 2;
}

message BatchCreateClientLabelsRpcRequest {
  repeated ClientLabelCreation creations = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message BatchCreateClientLabelsRpcResponse {
  repeated int32 ids = 1;
  bool isCreated = 2;
}

message ClientLabelModification {
  int32 id = 1;
  bool shouldUpdateCode = 2;
  string code = 3;
  bool shouldUpdateName = 4;
  string name = 5;
  bool shouldUpdateType = 6;
  ClientLabelTypeEnum type = 7;
  bool shouldUpdateIsDefault = 8;
  bool isDefault = 9;
  bool shouldUpdateRemark = 10;
  string remark = 11;
  bool shouldUpdateLabelStatus = 12;
  ClientDishLabelStatusEnum status =13;

}

message UpdateClientLabelRpcRequest {
  ClientLabelModification modification = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message UpdateClientLabelRpcResponse {
  bool isUpdated = 1;
}

message BatchUpdateClientLabelsRpcRequest {
  repeated ClientLabelModification modifications = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message BatchUpdateClientLabelsRpcResponse {
  bool isUpdated = 1;
}

message DeleteClientLabelsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message DeleteClientLabelsRpcResponse {
  bool isDeleted = 1;
}

message GetDefaultClientLabelByTypeRpcRequest {
  int32 enterpriseId = 1;
  ClientLabelTypeEnum type = 2;
}

message GetDefaultClientLabelByTypeRpcResponse {
  SingleClientLabelRpcResponse response = 1;
}

message GetClientLabelByStallIdAndTypeRpcRequest {
  int32 enterpriseId = 1;
  int32 stallId = 2;
  ClientLabelTypeEnum type = 3;
}

message GetClientLabelByStallIdAndTypeRpcResponse {
  SingleClientLabelRpcResponse response = 1;
}

message SingleClientLabelStallRefRpcResponse {
  int32 id = 1;
  int32 enterpriseId = 2;
  int32 labelId = 3;
  int32 stallId = 4;
  int32 createdBy = 5;
  int64 createdAt = 6;
  int32 creationSource = 7;
}

message GetClientLabelStallRefByIdRpcRequest {
  int32 id = 1;
  int32 enterpriseId = 2;
}

message GetClientLabelStallRefByIdRpcResponse {
  SingleClientLabelStallRefRpcResponse response = 1;
}

message GetClientLabelStallRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message GetClientLabelStallRefsByIdsRpcResponse {
  repeated SingleClientLabelStallRefRpcResponse responses = 1;
}

message QueryClientLabelStallRefsByConditionRpcRequest {
  int32 enterpriseId = 1;
  bool shouldFilterLabelIds = 2;
  repeated int32 labelIds = 3;
  bool shouldFilterStallIds = 4;
  repeated int32 stallIds = 5;
}

message QueryClientLabelStallRefsByConditionRpcResponse {
  repeated SingleClientLabelStallRefRpcResponse responses = 1;
}

message ClientLabelStallRefCreation{
  int32 labelId = 1;
  int32 stallId = 2;
}

message CreateClientLabelStallRefRpcRequest {
  ClientLabelStallRefCreation creation = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message CreateClientLabelStallRefRpcResponse {
  int32 id = 1;
  bool isCreated = 2;
}

message BatchCreateClientLabelStallRefsRpcRequest {
  repeated ClientLabelStallRefCreation creations = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message BatchCreateClientLabelStallRefsRpcResponse {
  repeated int32 ids = 1;
  bool isCreated = 2;
}

message DeleteClientLabelStallRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message DeleteClientLabelStallRefsRpcResponse {
  bool isDeleted = 1;
}

message DeleteClientLabelStallRefsByLabelIdAndStallIdsRpcRequest {
  int32 enterpriseId = 1;
  int32 labelId = 2;
  repeated int32 stallIds = 3;
}

message DeleteClientLabelStallRefsByLabelIdAndStallIdsRpcResponse {
  bool isDeleted = 1;
}

message BatchUpdateClientLabelByDistrictIdsRpcRequest {
  int32 enterpriseId = 1;
  int32 updatedBy = 2;
  int32 updateSource = 3;
  repeated SingleUpdateClientLabelByDistrictIdRpcRequest stallDistricts = 4;
}

message SingleUpdateClientLabelByDistrictIdRpcRequest {
  int32 stallId = 2;
  int32 districtId = 1;
}

message BatchUpdateClientLabelByDistrictIdsRpcResponse {
  bool isUpdated = 1;
}

message SingleClientLabelDistrictRefRpcResponse {
  int32 id = 1;
  int32 enterpriseId = 2;
  int32 labelId = 3;
  int32 districtId = 4;
  int32 createdBy = 5;
  int64 createdAt = 6;
  int32 creationSource = 7;
}

message GetClientLabelDistrictRefByIdRpcRequest {
  int32 id = 1;
  int32 enterpriseId = 2;
}

message GetClientLabelDistrictRefByIdRpcResponse {
  SingleClientLabelDistrictRefRpcResponse response = 1;
}

message GetClientLabelDistrictRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message GetClientLabelDistrictRefsByIdsRpcResponse {
  repeated SingleClientLabelDistrictRefRpcResponse responses = 1;
}

message QueryClientLabelDistrictRefsByConditionRpcRequest {
  int32 enterpriseId = 1;
  bool shouldFilterLabelIds = 2;
  repeated int32 labelIds = 3;
  bool shouldFilterDistrictIds = 4;
  repeated int32 districtIds = 5;
}

message QueryClientLabelDistrictRefsByConditionRpcResponse {
  repeated SingleClientLabelDistrictRefRpcResponse responses = 1;
}

message ClientLabelDistrictRefCreation{
  int32 labelId = 1;
  int32 districtId = 2;
}

message CreateClientLabelDistrictRefRpcRequest {
  ClientLabelDistrictRefCreation creation = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message CreateClientLabelDistrictRefRpcResponse {
  int32 id = 1;
  bool isCreated = 2;
}

message BatchCreateClientLabelDistrictRefsRpcRequest {
  repeated ClientLabelDistrictRefCreation creations = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message BatchCreateClientLabelDistrictRefsRpcResponse {
  repeated int32 ids = 1;
  bool isCreated = 2;
}

message DeleteClientLabelDistrictRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message DeleteClientLabelDistrictRefsRpcResponse {
  bool isDeleted = 1;
}

enum DeliveryTemplateTypeEnum {
  DELIVERY_TEMPLATE_TYPE_UNKNOWN = 0;
  DELIVERY_TEMPLATE_TYPE_DELIVERY = 1;//配送
  DELIVERY_TEMPLATE_TYPE_FREIGHT = 2;//运费
}
enum DeliveryTemplateRuleTypeEnum {
  DELIVERY_TEMPLATE_RULE_TYPE_UNKNOWN = 0;
  DELIVERY_TEMPLATE_RULE_TYPE_DELIVERY = 1;//配送
  DELIVERY_TEMPLATE_RULE_TYPE_BY_AMOUNT = 2;//金额
  DELIVERY_TEMPLATE_RULE_TYPE_BY_NUMBER = 3;//数量
}

message SingleDeliveryTemplateRpcResponse {
  int32 id = 1;
  int32 enterpriseId = 2;
  string code = 3;
  string name = 4;
  DeliveryTemplateTypeEnum type = 5;
  DeliveryTemplateRuleTypeEnum ruleType = 6;
  bool isDefault = 7;
  string remark = 8;
  int32 createdBy = 9;
  int64 createdAt = 10;
  int32 creationSource = 11;
  int32 updatedBy = 12;
  int64 updatedAt = 13;
  int32 updateSource = 14;
  bool isDeleted = 15;
}

message GetDeliveryTemplateByIdRpcRequest {
  int32 id = 1;
  int32 enterpriseId = 2;
  bool includeDeleted = 3;
}

message GetDeliveryTemplateByIdRpcResponse {
  SingleDeliveryTemplateRpcResponse response = 1;
}

message GetDeliveryTemplatesByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
  bool includeDeleted = 3;
}

message GetDeliveryTemplatesByIdsRpcResponse {
  repeated SingleDeliveryTemplateRpcResponse responses = 1;
}

message QueryDeliveryTemplatesByConditionRpcRequest {
  int32 enterpriseId = 1;
  bool shouldFilterCode = 2;
  string code = 3;
  bool shouldFilterName = 4;
  string name = 5;
  bool shouldFilterType = 6;
  DeliveryTemplateTypeEnum type = 7;
  bool shouldFilterRuleType = 8;
  DeliveryTemplateRuleTypeEnum ruleType = 9;
  bool shouldFilterIsDefault = 10;
  bool isDefault = 11;
  bool includeDeleted = 12;
}

message QueryDeliveryTemplatesByConditionRpcResponse {
  repeated SingleDeliveryTemplateRpcResponse responses = 1;
}

message DeliveryTemplateCreation{
  string code = 1;
  string name = 2;
  DeliveryTemplateTypeEnum type = 3;
  DeliveryTemplateRuleTypeEnum ruleType = 4;
  bool isDefault = 5;
  string remark = 6;
}

message CreateDeliveryTemplateRpcRequest {
  DeliveryTemplateCreation creation = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message CreateDeliveryTemplateRpcResponse {
  int32 id = 1;
  bool isCreated = 2;
}

message DeliveryTemplateModification {
  int32 id = 1;
  bool shouldUpdateCode = 2;
  string code = 3;
  bool shouldUpdateName = 4;
  string name = 5;
  bool shouldUpdateType = 6;
  DeliveryTemplateTypeEnum type = 7;
  bool shouldUpdateRuleType = 8;
  DeliveryTemplateRuleTypeEnum ruleType = 9;
  bool shouldUpdateIsDefault = 10;
  bool isDefault = 11;
  bool shouldUpdateRemark = 12;
  string remark = 13;
}

message UpdateDeliveryTemplateRpcRequest {
  DeliveryTemplateModification modification = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message UpdateDeliveryTemplateRpcResponse {
  bool isUpdated = 1;
}

message DeleteDeliveryTemplatesByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message DeleteDeliveryTemplatesRpcResponse {
  bool isDeleted = 1;
}

message GetDeliveryTemplatesBySupplierIdsRpcRequest {
  int32 enterpriseId = 1;
  repeated int32 supplierIds = 2;
  DeliveryTemplateTypeEnum type = 3;
}

message GetDeliveryTemplatesBySupplierIdsRpcResponse {
  map<int32, SingleDeliveryTemplateRpcResponse> deliveryTemplates = 1;
}

message GetStallDeliveryRuleConfigRpcRequest {
  int32 enterpriseId = 1;
  int32 stallId = 2;
}

message GetStallDeliveryRuleConfigRpcResponse {
  map<int32, DeliveryRuleConfigJson> supplierRuleConfig = 1;
}

message GetStallDeliveryRuleConfigBySupplierIdsRpcRequest {
  int32 enterpriseId = 1;
  int32 stallId = 2;
  repeated int32 supplierIds = 3;
}

message GetStallDeliveryRuleConfigBySupplierIdsRpcResponse {
  //key is supplierId value is stallRuleConfigJson
  map<int32, DeliveryRuleConfigJson> supplierRuleConfig = 1;
}

message GetStallFreightRuleConfigBySupplierIdsRpcRequest {
  int32 enterpriseId = 1;
  int32 stallId = 2;
  repeated int32 supplierIds = 3;
}

message GetStallFreightRuleConfigBySupplierIdsRpcResponse {
  //key is supplierId value is stallRuleConfigJson
  map<int32, DeliveryRuleConfigJson> supplierRuleConfig = 1;
}


message GetDefaultDeliveryTemplateAndRuleRpcRequest {
  int32 enterpriseId = 1;
  DeliveryTemplateTypeEnum type = 2;
}

message GetDefaultDeliveryTemplateAndRuleRpcResponse {
  SingleDeliveryTemplateRpcResponse template = 1;
  SingleDeliveryRuleRpcResponse rule = 2;

}
enum DeliveryTemplateSupplierRefTypeEnum {
  DELIVERY_TEMPLATE_SUPPLIER_REF_TYPE_UNKNOWN = 0;
  DELIVERY_TEMPLATE_SUPPLIER_REF_TYPE_WAREHOUSE = 1;// 仓库
  DELIVERY_TEMPLATE_SUPPLIER_REF_TYPE_SUPPLIER = 2;// 供应商
}

message SingleDeliveryTemplateSupplierRefRpcResponse {
  int32 id = 1;
  int32 enterpriseId = 2;
  int32 deliveryTemplateId = 3;
  DeliveryTemplateSupplierRefTypeEnum type = 4;
  int32 sourceId = 5;
  int32 createdBy = 6;
  int64 createdAt = 7;
  int32 creationSource = 8;
}

message GetDeliveryTemplateSupplierRefByIdRpcRequest {
  int32 id = 1;
  int32 enterpriseId = 2;
}

message GetDeliveryTemplateSupplierRefByIdRpcResponse {
  SingleDeliveryTemplateSupplierRefRpcResponse response = 1;
}

message GetDeliveryTemplateSupplierRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message GetDeliveryTemplateSupplierRefsByIdsRpcResponse {
  repeated SingleDeliveryTemplateSupplierRefRpcResponse responses = 1;
}

message QueryDeliveryTemplateSupplierRefsByConditionRpcRequest {
  int32 enterpriseId = 1;
  bool shouldFilterDeliveryTemplateIds = 2;
  repeated int32 deliveryTemplateIds = 3;
  bool shouldFilterType = 4;
  DeliveryTemplateSupplierRefTypeEnum type = 5;
  bool shouldFilterSourceIds = 6;
  repeated int32 sourceIds = 7;
}

message QueryDeliveryTemplateSupplierRefsByConditionRpcResponse {
  repeated SingleDeliveryTemplateSupplierRefRpcResponse responses = 1;
}

message DeliveryTemplateSupplierRefCreation{
  int32 deliveryTemplateId = 1;
  DeliveryTemplateSupplierRefTypeEnum type = 2;
  int32 sourceId = 3;
}

message CreateDeliveryTemplateSupplierRefRpcRequest {
  DeliveryTemplateSupplierRefCreation creation = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message CreateDeliveryTemplateSupplierRefRpcResponse {
  int32 id = 1;
  bool isCreated = 2;
}

message BatchCreateDeliveryTemplateSupplierRefsRpcRequest {
  repeated DeliveryTemplateSupplierRefCreation creations = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message BatchCreateDeliveryTemplateSupplierRefsRpcResponse {
  repeated int32 ids = 1;
  bool isCreated = 2;
}

message DeleteDeliveryTemplateSupplierRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message DeleteDeliveryTemplateSupplierRefsRpcResponse {
  bool isDeleted = 1;
}

message SingleDeliveryRuleRpcResponse {
  int32 id = 1;
  int32 enterpriseId = 2;
  int32 deliveryTemplateId = 3;
  bool isDefault = 4;
  DeliveryRuleConfigJson configJson = 5;
  int32 createdBy = 6;
  int64 createdAt = 7;
  int32 creationSource = 8;
  int32 updatedBy = 9;
  int64 updatedAt = 10;
  int32 updateSource = 11;
  bool isDeleted = 12;
}

message DeliveryRuleConfigJson {
  DeliveryTemplateRuleTypeEnum ruleType = 1;
  repeated Rule rules = 2;
}

message Rule {
  string startTime = 1;
  string endTime = 2;
  bool monday = 3;
  bool tuesday = 4;
  bool wednesday = 5;
  bool thursday = 6;
  bool friday = 7;
  bool saturday = 8;
  bool sunday = 9;
  string orderAmount = 10;
  string fixedFee = 11;
  string percentageFee = 12;
  string itemCount = 13;
  int32 unitId = 14;
  string unitFee = 15;
}

message GetDeliveryRuleByIdRpcRequest {
  int32 id = 1;
  int32 enterpriseId = 2;
  bool includeDeleted = 3;
}

message GetDeliveryRuleByIdRpcResponse {
  SingleDeliveryRuleRpcResponse response = 1;
}

message GetDeliveryRulesByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
  bool includeDeleted = 3;
}

message GetDeliveryRulesByIdsRpcResponse {
  repeated SingleDeliveryRuleRpcResponse responses = 1;
}

message QueryDeliveryRulesByConditionRpcRequest {
  int32 enterpriseId = 1;
  bool shouldFilterDeliveryTemplateIds = 2;
  repeated int32 deliveryTemplateIds = 3;
  bool shouldFilterIsDefault = 4;
  bool isDefault = 5;
  bool includeDeleted = 6;
}

message QueryDeliveryRulesByConditionRpcResponse {
  repeated SingleDeliveryRuleRpcResponse responses = 1;
}

message DeliveryRuleCreation{
  int32 deliveryTemplateId = 1;
  bool isDefault = 2;
  bool shouldCreateConfigJson = 3;
  DeliveryRuleConfigJson configJson = 4;
}

message CreateDeliveryRuleRpcRequest {
  DeliveryRuleCreation creation = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message CreateDeliveryRuleRpcResponse {
  int32 id = 1;
  bool isCreated = 2;
}

message BatchCreateDeliveryRulesRpcRequest {
  repeated DeliveryRuleCreation creations = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message BatchCreateDeliveryRulesRpcResponse {
  repeated int32 ids = 1;
  bool isCreated = 2;
}

message DeliveryRuleModification {
  int32 id = 1;
  bool shouldUpdateDeliveryTemplateId = 2;
  int32 deliveryTemplateId = 3;
  bool shouldUpdateIsDefault = 4;
  bool isDefault = 5;
  bool shouldUpdateConfigJson = 6;
  DeliveryRuleConfigJson configJson = 7;
}

message UpdateDeliveryRuleRpcRequest {
  DeliveryRuleModification modification = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message UpdateDeliveryRuleRpcResponse {
  bool isUpdated = 1;
}

message BatchUpdateDeliveryRulesRpcRequest {
  repeated DeliveryRuleModification modifications = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message BatchUpdateDeliveryRulesRpcResponse {
  bool isUpdated = 1;
}

message DeleteDeliveryRulesByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
  int32 updatedBy = 3;
  int32 updateSource = 4;
}

message DeleteDeliveryRulesRpcResponse {
  bool isDeleted = 1;
}

message SingleDeliveryRuleLabelRefRpcResponse {
  int32 id = 1;
  int32 enterpriseId = 2;
  int32 deliveryRuleId = 3;
  int32 labelId = 4;
  int32 createdBy = 5;
  int64 createdAt = 6;
  int32 creationSource = 7;
}

message GetDeliveryRuleLabelRefByIdRpcRequest {
  int32 id = 1;
  int32 enterpriseId = 2;
}

message GetDeliveryRuleLabelRefByIdRpcResponse {
  SingleDeliveryRuleLabelRefRpcResponse response = 1;
}

message GetDeliveryRuleLabelRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message GetDeliveryRuleLabelRefsByIdsRpcResponse {
  repeated SingleDeliveryRuleLabelRefRpcResponse responses = 1;
}

message QueryDeliveryRuleLabelRefsByConditionRpcRequest {
  int32 enterpriseId = 1;
  bool shouldFilterDeliveryRuleIds = 2;
  repeated int32 deliveryRuleIds = 3;
  bool shouldFilterLabelIds = 4;
  repeated int32 labelIds = 5;
}

message QueryDeliveryRuleLabelRefsByConditionRpcResponse {
  repeated SingleDeliveryRuleLabelRefRpcResponse responses = 1;
}

message DeliveryRuleLabelRefCreation{
  int32 deliveryRuleId = 1;
  int32 labelId = 2;
}

message CreateDeliveryRuleLabelRefRpcRequest {
  DeliveryRuleLabelRefCreation creation = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message CreateDeliveryRuleLabelRefRpcResponse {
  int32 id = 1;
  bool isCreated = 2;
}

message BatchCreateDeliveryRuleLabelRefsRpcRequest {
  repeated DeliveryRuleLabelRefCreation creations = 1;
  int32 enterpriseId = 2;
  int32 createdBy = 3;
  int32 creationSource = 4;
}

message BatchCreateDeliveryRuleLabelRefsRpcResponse {
  repeated int32 ids = 1;
  bool isCreated = 2;
}

message DeleteDeliveryRuleLabelRefsByIdsRpcRequest {
  repeated int32 ids = 1;
  int32 enterpriseId = 2;
}

message DeleteDeliveryRuleLabelRefsRpcResponse {
  bool isDeleted = 1;
}