namespace HaWeb.Models; using HaDocument.Models; public enum SearchResultType { Success, OutOfBounds, NotFound, InvalidSearchTerm } public enum SearchType { Letters, Register, Science } public class SucheViewModel { public List<(int Year, List LetterList)>? Letters { get; private set; } public List? Comments { get; private set; } public Dictionary>? Marginals { get; private set; } public int Count { get; private set; } public int ActivePage { get; private set; } public bool? IncludeComments { get; private set; } public string ActiveSearch { get; private set; } public List? AvailablePages { get; private set; } public Dictionary>? SearchResults { get; private set; } public SearchResultType SearchResultType { get; private set; } public SearchType SearchType { get; private set; } public SucheViewModel( SearchType searchType, SearchResultType searchResultType, bool? includeComments, int activePage, List? availablePages, string activeSearch, Dictionary>? searchResults, List<(int Year, List LetterList)>? letters, List? comments, Dictionary>? marginals ) { Letters = letters; if (letters != null) Count = letters.Select(x => x.LetterList.Count).Aggregate(0, (x, y) => { x += y; return x; }); else Count = 0; SearchType = searchType; SearchResultType = searchResultType; ActivePage = activePage; AvailablePages = availablePages; ActiveSearch = activeSearch; SearchResults = searchResults; Comments = comments; Marginals = marginals; IncludeComments = includeComments; } }