| | | 1 | | using Newtonsoft.Json; |
| | | 2 | | |
| | | 3 | | namespace Services.ApiServices.FidApi.Models; |
| | | 4 | | |
| | | 5 | | /// <summary>Ответ <c>/api/feed/articles/price-explanation</c>: расшифровка цены позиции по сборкам кабинетов.</summary> |
| | | 6 | | public sealed class FidPriceExplanationResponse |
| | | 7 | | { |
| | | 8 | | [JsonProperty("generatedAt")] |
| | | 9 | | public DateTime GeneratedAt { get; init; } |
| | | 10 | | |
| | | 11 | | [JsonProperty("key")] |
| | | 12 | | public string Key { get; init; } = string.Empty; |
| | | 13 | | |
| | | 14 | | /// <summary>Позиция есть хотя бы в одном плане цен.</summary> |
| | | 15 | | [JsonProperty("found")] |
| | | 16 | | public bool Found { get; init; } |
| | | 17 | | |
| | | 18 | | /// <summary>По одному объекту на сборку; без runId — последняя сборка каждого кабинета, где есть план.</summary> |
| | | 19 | | [JsonProperty("explanations")] |
| | | 20 | | public List<FidPriceExplanation> Explanations { get; init; } = []; |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | public sealed class FidPriceExplanation |
| | | 24 | | { |
| | | 25 | | [JsonProperty("cabinetKey")] |
| | 24 | 26 | | public string CabinetKey { get; init; } = string.Empty; |
| | | 27 | | |
| | | 28 | | [JsonProperty("runId")] |
| | 16 | 29 | | public long RunId { get; init; } |
| | | 30 | | |
| | | 31 | | [JsonProperty("assembledAt")] |
| | 16 | 32 | | public DateTime AssembledAt { get; init; } |
| | | 33 | | |
| | | 34 | | [JsonProperty("assembledBy")] |
| | 16 | 35 | | public string? AssembledBy { get; init; } |
| | | 36 | | |
| | | 37 | | /// <summary>В плане сборки сохранены все позиции; у старых сборок только отправленные цены, и позиции может не быть |
| | | 38 | | [JsonProperty("hasFullPlan")] |
| | 16 | 39 | | public bool HasFullPlan { get; init; } |
| | | 40 | | |
| | | 41 | | /// <summary>Позиция есть в плане этой сборки.</summary> |
| | | 42 | | [JsonProperty("found")] |
| | 16 | 43 | | public bool Found { get; init; } |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Итог словами: <c>priced</c> (цена есть), <c>annul-only</c> (только обнуление), <c>invalid</c> (цена рассчиталась |
| | | 47 | | /// или артикул повторялся), <c>external</c> (цену ведёт другая программа), <c>below-min</c> (ниже минимальной цены |
| | | 48 | | /// </summary> |
| | | 49 | | [JsonProperty("outcome")] |
| | 16 | 50 | | public string? Outcome { get; init; } |
| | | 51 | | |
| | | 52 | | /// <summary>Исходный код решения плана: send, unchanged, skipped-no-price, skipped-invalid, skipped-external, skipp |
| | | 53 | | [JsonProperty("decision")] |
| | 16 | 54 | | public string? Decision { get; init; } |
| | | 55 | | |
| | | 56 | | /// <summary>Пояснение к решению, например «нет данных Озона о текущей цене»; у позиции вне плана — почему её там не |
| | | 57 | | [JsonProperty("reason")] |
| | 16 | 58 | | public string? Reason { get; init; } |
| | | 59 | | |
| | | 60 | | /// <summary>Рассчитанная цена продажи, ₽; null — цены нет.</summary> |
| | | 61 | | [JsonProperty("finalPrice")] |
| | 16 | 62 | | public decimal? FinalPrice { get; init; } |
| | | 63 | | |
| | | 64 | | /// <summary>Зачёркнутая цена после проверки правил Озона, ₽.</summary> |
| | | 65 | | [JsonProperty("oldPrice")] |
| | 16 | 66 | | public decimal? OldPrice { get; init; } |
| | | 67 | | |
| | | 68 | | /// <summary>Минимальная цена после проверки правил Озона, ₽.</summary> |
| | | 69 | | [JsonProperty("minPrice")] |
| | 16 | 70 | | public decimal? MinPrice { get; init; } |
| | | 71 | | |
| | | 72 | | /// <summary>Склад, чья закупочная цена легла в расчёт.</summary> |
| | | 73 | | [JsonProperty("priceWarehouse")] |
| | 16 | 74 | | public string? PriceWarehouse { get; init; } |
| | | 75 | | |
| | | 76 | | /// <summary>Поставщик этой цены.</summary> |
| | | 77 | | [JsonProperty("priceSupplier")] |
| | 16 | 78 | | public string? PriceSupplier { get; init; } |
| | | 79 | | |
| | | 80 | | /// <summary>Закупочная цена за единицу, без кратности, ₽.</summary> |
| | | 81 | | [JsonProperty("purchasePrice")] |
| | 16 | 82 | | public decimal? PurchasePrice { get; init; } |
| | | 83 | | |
| | | 84 | | /// <summary>Кратность: сколько единиц в одной позиции Озона.</summary> |
| | | 85 | | [JsonProperty("multiplicity")] |
| | 16 | 86 | | public int? Multiplicity { get; init; } |
| | | 87 | | |
| | | 88 | | /// <summary>Склады, обнулённые у позиции минимальной ценой склада.</summary> |
| | | 89 | | [JsonProperty("zeroedWarehouses")] |
| | 24 | 90 | | public List<string> ZeroedWarehouses { get; init; } = []; |
| | | 91 | | |
| | | 92 | | [JsonProperty("formula")] |
| | 20 | 93 | | public FidPriceFormula? Formula { get; init; } |
| | | 94 | | |
| | | 95 | | [JsonProperty("ozon")] |
| | 20 | 96 | | public FidPriceOzon? Ozon { get; init; } |
| | | 97 | | |
| | | 98 | | /// <summary>Правки цен под правила Озона, перечисленные через «; ». null — правок не было.</summary> |
| | | 99 | | [JsonProperty("correction")] |
| | 16 | 100 | | public string? Correction { get; init; } |
| | | 101 | | } |
| | | 102 | | |
| | | 103 | | public sealed class FidPriceFormula |
| | | 104 | | { |
| | | 105 | | /// <summary>Закупка × кратность, ₽.</summary> |
| | | 106 | | [JsonProperty("purchaseWithMultiplicity")] |
| | | 107 | | public decimal? PurchaseWithMultiplicity { get; init; } |
| | | 108 | | |
| | | 109 | | /// <summary>Сумма фиксированных комиссий FBS: обработка отправления, логистика, доставка до пункта, ₽.</summary> |
| | | 110 | | [JsonProperty("fixedCommission")] |
| | | 111 | | public decimal? FixedCommission { get; init; } |
| | | 112 | | |
| | | 113 | | /// <summary>Процент вознаграждения Озона по категории.</summary> |
| | | 114 | | [JsonProperty("rewardPercent")] |
| | | 115 | | public decimal? RewardPercent { get; init; } |
| | | 116 | | |
| | | 117 | | /// <summary>Надбавка к проценту комиссии, пунктов. В плане не хранится: значение профиля по умолчанию.</summary> |
| | | 118 | | [JsonProperty("commissionSurcharge")] |
| | | 119 | | public decimal? CommissionSurcharge { get; init; } |
| | | 120 | | |
| | | 121 | | /// <summary>Вознаграждение плюс надбавка, %.</summary> |
| | | 122 | | [JsonProperty("percentageCommission")] |
| | | 123 | | public decimal? PercentageCommission { get; init; } |
| | | 124 | | |
| | | 125 | | /// <summary>Цена по формуле с округлением вверх, ₽; null, если проценты в сумме не меньше 100.</summary> |
| | | 126 | | [JsonProperty("calculatedPrice")] |
| | | 127 | | public decimal? CalculatedPrice { get; init; } |
| | | 128 | | |
| | | 129 | | /// <summary>false — итоговая цена отличается от чистого расчёта (её оптимизировали по индексу цены Озона).</summary |
| | | 130 | | [JsonProperty("matchesFinalPrice")] |
| | | 131 | | public bool? MatchesFinalPrice { get; init; } |
| | | 132 | | |
| | | 133 | | /// <summary>Готовая запись расчёта: <c>ceil((1285 × 1 + 227) / (1 − (47 + 2) / 100)) = 2965</c>.</summary> |
| | | 134 | | [JsonProperty("expression")] |
| | | 135 | | public string? Expression { get; init; } |
| | | 136 | | } |
| | | 137 | | |
| | | 138 | | /// <summary>Что Озон показывал на момент сборки.</summary> |
| | | 139 | | public sealed class FidPriceOzon |
| | | 140 | | { |
| | | 141 | | [JsonProperty("hasData")] |
| | | 142 | | public bool HasData { get; init; } |
| | | 143 | | |
| | | 144 | | [JsonProperty("price")] |
| | | 145 | | public decimal? Price { get; init; } |
| | | 146 | | |
| | | 147 | | [JsonProperty("oldPrice")] |
| | | 148 | | public decimal? OldPrice { get; init; } |
| | | 149 | | |
| | | 150 | | [JsonProperty("minPrice")] |
| | | 151 | | public decimal? MinPrice { get; init; } |
| | | 152 | | |
| | | 153 | | [JsonProperty("priceIndex")] |
| | | 154 | | public decimal? PriceIndex { get; init; } |
| | | 155 | | |
| | | 156 | | [JsonProperty("marketMinPrice")] |
| | | 157 | | public decimal? MarketMinPrice { get; init; } |
| | | 158 | | } |