# -*- coding: utf-8 -*-

"""
shelldatareportingapis

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from shelldatareportingapis.api_helper import APIHelper
from shelldatareportingapis.models.eid_document import EIDDocument


class EIDDocumentResponse(object):

    """Implementation of the 'EIDDocumentResponse' model.

    TODO: type model description here.

    Attributes:
        request_id (str): UUID (according to RFC 4122 standards) for requests
            and responses. This will be played back in the response from the
            request.
        status (str): Indicates overall status of the request. Allowed values:
            SUCCESS, FAILED
        data (List[EIDDocument]): TODO: type description here.
        page_size (int): Number of records returned in the response
        page (int): Current page
        total_pages (int): Total number of pages available for the requested
            data
        total_records (int): Total number of elements corresponding to the
            request
        is_first_page (bool): True if it is the first page, false otherwise
        is_last_page (bool): True if it is the last page, false, otherwise.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "request_id": 'RequestId',
        "status": 'Status',
        "data": 'Data',
        "page_size": 'PageSize',
        "page": 'Page',
        "total_pages": 'TotalPages',
        "total_records": 'TotalRecords',
        "is_first_page": 'IsFirstPage',
        "is_last_page": 'IsLastPage'
    }

    _optionals = [
        'request_id',
        'status',
        'data',
        'page_size',
        'page',
        'total_pages',
        'total_records',
        'is_first_page',
        'is_last_page',
    ]

    def __init__(self,
                 request_id=APIHelper.SKIP,
                 status=APIHelper.SKIP,
                 data=APIHelper.SKIP,
                 page_size=APIHelper.SKIP,
                 page=APIHelper.SKIP,
                 total_pages=APIHelper.SKIP,
                 total_records=APIHelper.SKIP,
                 is_first_page=APIHelper.SKIP,
                 is_last_page=APIHelper.SKIP):
        """Constructor for the EIDDocumentResponse class"""

        # Initialize members of the class
        if request_id is not APIHelper.SKIP:
            self.request_id = request_id 
        if status is not APIHelper.SKIP:
            self.status = status 
        if data is not APIHelper.SKIP:
            self.data = data 
        if page_size is not APIHelper.SKIP:
            self.page_size = page_size 
        if page is not APIHelper.SKIP:
            self.page = page 
        if total_pages is not APIHelper.SKIP:
            self.total_pages = total_pages 
        if total_records is not APIHelper.SKIP:
            self.total_records = total_records 
        if is_first_page is not APIHelper.SKIP:
            self.is_first_page = is_first_page 
        if is_last_page is not APIHelper.SKIP:
            self.is_last_page = is_last_page 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """

        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        request_id = dictionary.get("RequestId") if dictionary.get("RequestId") else APIHelper.SKIP
        status = dictionary.get("Status") if dictionary.get("Status") else APIHelper.SKIP
        data = None
        if dictionary.get('Data') is not None:
            data = [EIDDocument.from_dictionary(x) for x in dictionary.get('Data')]
        else:
            data = APIHelper.SKIP
        page_size = dictionary.get("PageSize") if dictionary.get("PageSize") else APIHelper.SKIP
        page = dictionary.get("Page") if dictionary.get("Page") else APIHelper.SKIP
        total_pages = dictionary.get("TotalPages") if dictionary.get("TotalPages") else APIHelper.SKIP
        total_records = dictionary.get("TotalRecords") if dictionary.get("TotalRecords") else APIHelper.SKIP
        is_first_page = dictionary.get("IsFirstPage") if "IsFirstPage" in dictionary.keys() else APIHelper.SKIP
        is_last_page = dictionary.get("IsLastPage") if "IsLastPage" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(request_id,
                   status,
                   data,
                   page_size,
                   page,
                   total_pages,
                   total_records,
                   is_first_page,
                   is_last_page)
