| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 3 | | |
| | | 4 | | namespace OzonDomains.Models; |
| | | 5 | | |
| | | 6 | | /// <summary>Заказ, размещённый в Berg через <c>ordering/place_order.json</c>.</summary> |
| | | 7 | | [Table("BergOrders")] |
| | | 8 | | public sealed class BergOrder |
| | | 9 | | { |
| | | 10 | | public long Id { get; set; } |
| | | 11 | | |
| | | 12 | | /// <summary>Идентификатор заказа на стороне Berg — по нему запрашиваются статусы.</summary> |
| | | 13 | | public long ExternalOrderId { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary>Числовой ключ идемпотентности, переданный в order[reference].</summary> |
| | | 16 | | public long? Reference { get; set; } |
| | | 17 | | |
| | | 18 | | public int DispatchType { get; set; } |
| | | 19 | | public DateTime DispatchAt { get; set; } |
| | | 20 | | public int DispatchTime { get; set; } |
| | | 21 | | public long? ShipmentAddressId { get; set; } |
| | | 22 | | [MaxLength(300)] public string? ShipmentAddress { get; set; } |
| | | 23 | | public int? PaymentType { get; set; } |
| | | 24 | | |
| | | 25 | | /// <summary>Заказ размещён в режиме проверки: Berg сохранил его, но не обрабатывает.</summary> |
| | | 26 | | public bool IsTest { get; set; } |
| | | 27 | | |
| | | 28 | | [Required, MaxLength(50)] public string Status { get; set; } = BergOrderStatus.Placed; |
| | | 29 | | |
| | | 30 | | public string? RequestJson { get; set; } |
| | | 31 | | public string? ResponseJson { get; set; } |
| | | 32 | | |
| | | 33 | | [MaxLength(450)] public string? CreatedBy { get; set; } |
| | | 34 | | public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow; |
| | | 35 | | |
| | | 36 | | public ICollection<BergOrderItem> Items { get; set; } = new List<BergOrderItem>(); |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | public static class BergOrderStatus |
| | | 40 | | { |
| | | 41 | | public const string Placed = "Placed"; |
| | | 42 | | public const string Test = "Test"; |
| | | 43 | | } |
| | | 44 | | |
| | | 45 | | /// <summary>Строка заказа Berg. Статус у Berg живёт на строке, а не на заказе.</summary> |
| | | 46 | | [Table("BergOrderItems")] |
| | | 47 | | public sealed class BergOrderItem |
| | | 48 | | { |
| | 25 | 49 | | public long Id { get; set; } |
| | | 50 | | |
| | 25 | 51 | | public long BergOrderId { get; set; } |
| | 25 | 52 | | public BergOrder? BergOrder { get; set; } |
| | | 53 | | |
| | 2 | 54 | | public long? BergCartItemId { get; set; } |
| | | 55 | | |
| | 27 | 56 | | public int StudioOrderId { get; set; } |
| | | 57 | | |
| | | 58 | | /// <summary>sequence — номер строки в заказе Berg.</summary> |
| | 28 | 59 | | public int Sequence { get; set; } |
| | | 60 | | |
| | 2 | 61 | | public long ResourceId { get; set; } |
| | 2 | 62 | | public long WarehouseId { get; set; } |
| | | 63 | | |
| | 35 | 64 | | [Required, MaxLength(60)] public string Article { get; set; } = string.Empty; |
| | 35 | 65 | | [Required, MaxLength(100)] public string Brand { get; set; } = string.Empty; |
| | | 66 | | |
| | 2 | 67 | | public decimal Quantity { get; set; } |
| | 2 | 68 | | public decimal? Price { get; set; } |
| | | 69 | | |
| | | 70 | | /// <summary>Идентификатор статуса из справочника references/states.json.</summary> |
| | 3 | 71 | | public int? StateId { get; set; } |
| | 2 | 72 | | [MaxLength(200)] public string? StateName { get; set; } |
| | | 73 | | |
| | 0 | 74 | | [MaxLength(1000)] public string? Error { get; set; } |
| | | 75 | | } |