1+ // ReSharper disable InconsistentNaming
2+ namespace NineCWebMarket . Frontend . Api ;
3+
4+ public class NineCapiEnums
5+ {
6+ public enum MarketOrderType
7+ {
8+ cp ,
9+ cp_desc ,
10+ price ,
11+ price_desc ,
12+ grade ,
13+ grade_desc ,
14+ crystal ,
15+ crystal_desc ,
16+ crystal_per_price ,
17+ crystal_per_price_desc ,
18+ level ,
19+ level_desc ,
20+ opt_count ,
21+ opt_count_desc ,
22+ unit_price ,
23+ unit_price_desc
24+ }
25+
26+
27+ public static MarketOrderType FromMimirEnums ( ProductSortBy productSortBy , SortDirection sortDirection )
28+ {
29+ return productSortBy switch
30+ {
31+ ProductSortBy . CP => sortDirection switch
32+ {
33+ SortDirection . ASCENDING => MarketOrderType . cp ,
34+ SortDirection . DESCENDING => MarketOrderType . cp_desc ,
35+ _ => throw new ArgumentOutOfRangeException ( nameof ( sortDirection ) , sortDirection , null )
36+ } ,
37+ ProductSortBy . CRYSTAL => sortDirection switch
38+ {
39+ SortDirection . ASCENDING => MarketOrderType . crystal ,
40+ SortDirection . DESCENDING => MarketOrderType . crystal_desc ,
41+ _ => throw new ArgumentOutOfRangeException ( nameof ( sortDirection ) , sortDirection , null )
42+ } ,
43+ ProductSortBy . GRADE => sortDirection switch
44+ {
45+ SortDirection . ASCENDING => MarketOrderType . grade ,
46+ SortDirection . DESCENDING => MarketOrderType . grade_desc ,
47+ _ => throw new ArgumentOutOfRangeException ( nameof ( sortDirection ) , sortDirection , null )
48+ } ,
49+ ProductSortBy . PRICE => sortDirection switch
50+ {
51+ SortDirection . ASCENDING => MarketOrderType . price ,
52+ SortDirection . DESCENDING => MarketOrderType . price_desc ,
53+ _ => throw new ArgumentOutOfRangeException ( nameof ( sortDirection ) , sortDirection , null )
54+ } ,
55+ ProductSortBy . UNIT_PRICE => sortDirection switch
56+ {
57+ SortDirection . ASCENDING => MarketOrderType . unit_price ,
58+ SortDirection . DESCENDING => MarketOrderType . unit_price_desc ,
59+ _ => throw new ArgumentOutOfRangeException ( nameof ( sortDirection ) , sortDirection , null )
60+ } ,
61+ ProductSortBy . CRYSTAL_PER_PRICE => sortDirection switch
62+ {
63+ SortDirection . ASCENDING => MarketOrderType . crystal_per_price ,
64+ SortDirection . DESCENDING => MarketOrderType . crystal_per_price_desc ,
65+ _ => throw new ArgumentOutOfRangeException ( nameof ( sortDirection ) , sortDirection , null )
66+ } ,
67+ _ => throw new ArgumentOutOfRangeException ( nameof ( productSortBy ) , productSortBy , null )
68+ } ;
69+ }
70+ }
0 commit comments