#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Vincent MOUTIA"
__copyright__ = "Copyright 2016, Republicube"
__credits__ = ["Vincent MOUTIA"]
__license__ = "GPL"
__version__ = "Version 3, 29 June 2007"
__maintainer__ = "Vincent MOUTIA"
__email__ = "vincent.moutia@gmail.com"
__status__ = "Development"


import json
import uDataDataset

class uDataDatasetPage:

	JsonData = None
	paths = None
	datasets = None
	queries = None

	nextPage = None
	page_size = None
	total_size = None
	previous_page = None
	facets = None
	page = None

	def __init__(self, JsonText):
		self.JsonData = JsonText
		self.paths = list()
		self.datasets = list()
		self.queries = list()

		self.nextPage = None
		self.page_size = None
		self.total_size = None
		self.previous_page = None
		self.facets = None
		self.page = None

		self.LevelMapper()

	def LevelMapper(self):
		""" In this section we will list keys that will be returned """		
		for key in self.JsonData:						
			self.paths.append(str(key))
			self.page = self.JsonData["page"]		
			self.previous_page = self.JsonData["previous_page"]
			self.facets = self.JsonData["facets"]
			self.nextPage = self.JsonData["next_page"]
			self.page_size = self.JsonData["page_size"]
			self.total_size = self.JsonData["total"]

		for line in self.JsonData["data"]:
			dataset = uDataDataset.uDataDataset(line["private"],line["featured"],line["frequency"],line["owner"],line["id"],line["badges"],line["title"],line["spatial"],line["resources"],line["description"],line["tags"],line["deleted"],line["metrics"],line["last_modified"],line["community_resources"],line["slug"],line["frequency_date"],line["license"],line["created_at"],line["uri"],line["temporal_coverage"],line["extras"],line["organization"],line["page"])
			self.datasets.append(dataset)

