local l={}function l.new()local l={}return l end function l.mock()local w=l.new()w.items={id="";type=""}w.keyword=""w.previousPageCursor=""w.nextPageCursor=""return w end function l.fromSearchItemsDetails(w)local U=l.new()U.items={}for l,w in ipairs(w.data)do U.items[l]={id=tostring(w.id),type=tostring(w.itemType)}end U.keyword=w.keyword U.previousPageCursor=w.previousPageCursor U.nextPageCursor=w.nextPageCursor return U end return l
--[[
	Model for sort results in the Catalog.
	{
		items =
		{
			"id": string,
			"type": string
		},

        "keyword":string,
        "previousPageCursor": string,
        "nextPageCursor": string
	}
]]

local SortResults = {}

function SortResults.new()
	local sortResults = {}

	return sortResults
end

function SortResults.mock()
	local self = SortResults.new()

	self.items = {
		id = "",
		type = "",
	}

	self.keyword = ""
	self.previousPageCursor = ""
	self.nextPageCursor = ""

	return self
end

function SortResults.fromSearchItemsDetails(itemDetailsResponse)
	local self = SortResults.new()

	self.items = {}
	for i, itemData in ipairs(itemDetailsResponse.data) do
		self.items[i] = {
			id = tostring(itemData.id),
			type = tostring(itemData.itemType),
		}
	end

	self.keyword = itemDetailsResponse.keyword
	self.previousPageCursor = itemDetailsResponse.previousPageCursor
	self.nextPageCursor = itemDetailsResponse.nextPageCursor

	return self
end

return SortResults
