< Summary

Information
Class: OzonOrdersWeb.Areas.Studio2.ViewModels.OzonChatViewModels.OzonChatListViewModel
Assembly: OzonOrdersWeb
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/Areas/Studio2/ViewModels/OzonChatViewModels/OzonChatListViewModel.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 60
Coverable lines: 60
Total lines: 158
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 42
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ClientId()100%210%
get_ClientName()100%210%
get_Chats()100%210%
get_TotalChatsCount()100%210%
get_TotalUnreadCount()100%210%
get_CurrentStatus()100%210%
get_CurrentChatType()100%210%
get_UnreadOnly()100%210%
get_PageSize()100%210%
get_CurrentPage()100%210%
get_TotalPages()100%210%
get_HasNext()100%210%
get_Cursor()100%210%
get_AvailableStatuses()100%210%
get_AvailableChatTypes()100%210%
GetStatusDescription(...)0%156120%
GetTypeDescription(...)0%110100%
GetStatusCssClass(...)0%110100%
GetTypeCssClass(...)0%110100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/Areas/Studio2/ViewModels/OzonChatViewModels/OzonChatListViewModel.cs

#LineLine coverage
 1using AppRepository.ApiServices.OzonApi.Filters;
 2
 3namespace OzonOrdersWeb.Areas.Studio2.ViewModels.OzonChatViewModels
 4{
 5    /// <summary>
 6    /// ViewModel для отображения списка чатов клиента
 7    /// </summary>
 8    public class OzonChatListViewModel
 9    {
 10        /// <summary>
 11        /// ID клиента Ozon
 12        /// </summary>
 013        public int ClientId { get; set; }
 14
 15        /// <summary>
 16        /// Название клиента Ozon
 17        /// </summary>
 018        public string ClientName { get; set; } = string.Empty;
 19
 20        /// <summary>
 21        /// Список чатов
 22        /// </summary>
 023        public List<ChatItem> Chats { get; set; } = new();
 24
 25        /// <summary>
 26        /// Общее количество чатов
 27        /// </summary>
 028        public long TotalChatsCount { get; set; }
 29
 30        /// <summary>
 31        /// Общее количество непрочитанных сообщений
 32        /// </summary>
 033        public long TotalUnreadCount { get; set; }
 34
 35        /// <summary>
 36        /// Текущий фильтр по статусу
 37        /// </summary>
 038        public string CurrentStatus { get; set; } = "All";
 39
 40        /// <summary>
 41        /// Текущий фильтр по типу чата
 42        /// </summary>
 043        public string CurrentChatType { get; set; } = "";
 44
 45        /// <summary>
 46        /// Фильтр только непрочитанные
 47        /// </summary>
 048        public bool UnreadOnly { get; set; }
 49
 50        /// <summary>
 51        /// Размер страницы
 52        /// </summary>
 053        public int PageSize { get; set; } = 30;
 54
 55        /// <summary>
 56        /// Текущая страница
 57        /// </summary>
 058        public int CurrentPage { get; set; } = 1;
 59
 60        /// <summary>
 61        /// Общее количество страниц
 62        /// </summary>
 063        public int TotalPages { get; set; } = 1;
 64
 65        /// <summary>
 66        /// Есть ли следующие страницы
 67        /// </summary>
 068        public bool HasNext { get; set; }
 69
 70        /// <summary>
 71        /// Курсор для пагинации
 72        /// </summary>
 073        public string? Cursor { get; set; }
 74
 75        /// <summary>
 76        /// Доступные статусы для фильтра
 77        /// </summary>
 078        public List<(string Value, string Text)> AvailableStatuses => new()
 079        {
 080            ("All", "Все чаты"),
 081            ("Opened", "Открытые"),
 082            ("Closed", "Закрытые"),
 083            ("UNSPECIFIED", "Не определён")
 084        };
 85
 86        /// <summary>
 87        /// Доступные типы чатов для фильтра
 88        /// </summary>
 089        public List<(string Value, string Text)> AvailableChatTypes => new()
 090        {
 091            ("", "Все типы"),
 092            ("Seller_Support", "Чат с поддержкой"),
 093            ("Buyer_Seller", "Чат с покупателем"),
 094            ("UNSPECIFIED", "Не определён")
 095        };
 96
 97        /// <summary>
 98        /// Получить описание статуса чата
 99        /// </summary>
 100        public string GetStatusDescription(string status)
 101        {
 0102            return status switch
 0103            {
 0104                "All" => "Все",
 0105                "OPENED" => "Открыт",
 0106                "Opened" => "Открыт",
 0107                "CLOSED" => "Закрыт",
 0108                "Closed" => "Закрыт",
 0109                "UNSPECIFIED" => "Не определён",
 0110                _ => status
 0111            };
 112        }
 113
 114        /// <summary>
 115        /// Получить описание типа чата
 116        /// </summary>
 117        public string GetTypeDescription(string type)
 118        {
 0119            return type switch
 0120            {
 0121                "Seller_Support" => "Чат с поддержкой",
 0122                "SELLER_SUPPORT" => "Чат с поддержкой",
 0123                "Buyer_Seller" => "Чат с покупателем",
 0124                "BUYER_SELLER" => "Чат с покупателем",
 0125                "UNSPECIFIED" => "Не определён",
 0126                _ => type
 0127            };
 128        }
 129
 130        /// <summary>
 131        /// Получить CSS класс для статуса чата
 132        /// </summary>
 133        public string GetStatusCssClass(string status)
 134        {
 0135            return status switch
 0136            {
 0137                "Opened" or "OPENED" => "badge bg-success",
 0138                "Closed" or "CLOSED" => "badge bg-secondary",
 0139                "UNSPECIFIED" => "badge bg-warning",
 0140                _ => "badge bg-primary"
 0141            };
 142        }
 143
 144        /// <summary>
 145        /// Получить CSS класс для типа чата
 146        /// </summary>
 147        public string GetTypeCssClass(string type)
 148        {
 0149            return type switch
 0150            {
 0151                "Seller_Support" or "SELLER_SUPPORT" => "badge bg-info",
 0152                "Buyer_Seller" or "BUYER_SELLER" => "badge bg-primary",
 0153                "UNSPECIFIED" => "badge bg-warning",
 0154                _ => "badge bg-secondary"
 0155            };
 156        }
 157    }
 158}