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

"""
ctddocumentation

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


class Information(object):

    """Implementation of the 'Information' model.

    TODO: type model description here.

    Attributes:
        site_id (int): TODO: type description here.
        resource_id (string): TODO: type description here.
        id (int): TODO: type description here.
        asset_id (int): TODO: type description here.
        code_sections (list of CodeSections): TODO: type description here.
        source (string): TODO: type description here.
        originator_name (string): TODO: type description here.
        originator_number (int): TODO: type description here.
        information_type_name (string): TODO: type description here.
        information_type_number (int): TODO: type description here.
        approved (bool): TODO: type description here.
        valid (bool): TODO: type description here.
        timestamp (string): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "site_id": 'site_id',
        "resource_id": 'resource_id',
        "id": 'id',
        "asset_id": 'asset_id',
        "code_sections": 'code_sections',
        "source": 'source',
        "originator_name": 'originator_name',
        "originator_number": 'originator_number',
        "information_type_name": 'information_type_name',
        "information_type_number": 'information_type_number',
        "approved": 'approved',
        "valid": 'valid',
        "timestamp": 'timestamp'
    }

    _optionals = [
        'site_id',
        'resource_id',
        'id',
        'asset_id',
        'code_sections',
        'source',
        'originator_name',
        'originator_number',
        'information_type_name',
        'information_type_number',
        'approved',
        'valid',
        'timestamp',
    ]

    def __init__(self,
                 site_id=APIHelper.SKIP,
                 resource_id=APIHelper.SKIP,
                 id=APIHelper.SKIP,
                 asset_id=APIHelper.SKIP,
                 code_sections=APIHelper.SKIP,
                 source=APIHelper.SKIP,
                 originator_name=APIHelper.SKIP,
                 originator_number=APIHelper.SKIP,
                 information_type_name=APIHelper.SKIP,
                 information_type_number=APIHelper.SKIP,
                 approved=APIHelper.SKIP,
                 valid=APIHelper.SKIP,
                 timestamp=APIHelper.SKIP):
        """Constructor for the Information class"""

        # Initialize members of the class
        if site_id is not APIHelper.SKIP:
            self.site_id = site_id 
        if resource_id is not APIHelper.SKIP:
            self.resource_id = resource_id 
        if id is not APIHelper.SKIP:
            self.id = id 
        if asset_id is not APIHelper.SKIP:
            self.asset_id = asset_id 
        if code_sections is not APIHelper.SKIP:
            self.code_sections = code_sections 
        if source is not APIHelper.SKIP:
            self.source = source 
        if originator_name is not APIHelper.SKIP:
            self.originator_name = originator_name 
        if originator_number is not APIHelper.SKIP:
            self.originator_number = originator_number 
        if information_type_name is not APIHelper.SKIP:
            self.information_type_name = information_type_name 
        if information_type_number is not APIHelper.SKIP:
            self.information_type_number = information_type_number 
        if approved is not APIHelper.SKIP:
            self.approved = approved 
        if valid is not APIHelper.SKIP:
            self.valid = valid 
        if timestamp is not APIHelper.SKIP:
            self.timestamp = timestamp 

    @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 dictionary is None:
            return None

        # Extract variables from the dictionary

        site_id = dictionary.get("site_id") if dictionary.get("site_id") else APIHelper.SKIP
        resource_id = dictionary.get("resource_id") if dictionary.get("resource_id") else APIHelper.SKIP
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        asset_id = dictionary.get("asset_id") if dictionary.get("asset_id") else APIHelper.SKIP
        code_sections = None
        if dictionary.get('code_sections') is not None:
            code_sections = [CodeSections.from_dictionary(x) for x in dictionary.get('code_sections')]
        else:
            code_sections = APIHelper.SKIP
        source = dictionary.get("source") if dictionary.get("source") else APIHelper.SKIP
        originator_name = dictionary.get("originator_name") if dictionary.get("originator_name") else APIHelper.SKIP
        originator_number = dictionary.get("originator_number") if dictionary.get("originator_number") else APIHelper.SKIP
        information_type_name = dictionary.get("information_type_name") if dictionary.get("information_type_name") else APIHelper.SKIP
        information_type_number = dictionary.get("information_type_number") if dictionary.get("information_type_number") else APIHelper.SKIP
        approved = dictionary.get("approved") if "approved" in dictionary.keys() else APIHelper.SKIP
        valid = dictionary.get("valid") if "valid" in dictionary.keys() else APIHelper.SKIP
        timestamp = dictionary.get("timestamp") if dictionary.get("timestamp") else APIHelper.SKIP
        # Return an object of this model
        return cls(site_id,
                   resource_id,
                   id,
                   asset_id,
                   code_sections,
                   source,
                   originator_name,
                   originator_number,
                   information_type_name,
                   information_type_number,
                   approved,
                   valid,
                   timestamp)
