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

"""
restapisdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from restapisdk.models.columns_input import ColumnsInput


class AddTableInput(object):

    """Implementation of the 'AddTableInput' model.

    TODO: type model description here.

    Attributes:
        name (string): Name of the table
        db_name (string): Name of the database in the data platform
        schema_name (string): Name of the schema in the database
        columns (list of ColumnsInput): A JSON array of column details

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": 'name',
        "db_name": 'dbName',
        "schema_name": 'schemaName',
        "columns": 'columns'
    }

    def __init__(self,
                 name=None,
                 db_name=None,
                 schema_name=None,
                 columns=None):
        """Constructor for the AddTableInput class"""

        # Initialize members of the class
        self.name = name
        self.db_name = db_name
        self.schema_name = schema_name
        self.columns = columns

    @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
        name = dictionary.get('name')
        db_name = dictionary.get('dbName')
        schema_name = dictionary.get('schemaName')
        columns = None
        if dictionary.get('columns') is not None:
            columns = [ColumnsInput.from_dictionary(x) for x in dictionary.get('columns')]

        # Return an object of this model
        return cls(name,
                   db_name,
                   schema_name,
                   columns)
