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

"""
billbeeapi

This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
from billbeeapi.api_helper import APIHelper


class RechnungsdruckWebAppControllersApiOrder(object):

    """Implementation of the 'Rechnungsdruck.WebApp.Controllers.Api.Order' model.

    TODO: type model description here.

    Attributes:
        id (int): TODO: type description here.
        external_id (string): TODO: type description here.
        invoice_number (string): TODO: type description here.
        invoice_created_at (datetime): TODO: type description here.
        invoice_date (datetime): TODO: type description here.
        created_at (datetime): TODO: type description here.
        paid_at (datetime): TODO: type description here.
        shipped_at (datetime): TODO: type description here.
        has_invoice (bool): TODO: type description here.
        order_state_id (int): TODO: type description here.
        order_state_text (string): TODO: type description here.
        total_gross (float): TODO: type description here.
        shop_name (string): TODO: type description here.
        can_create_auto_invoice (bool): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": 'Id',
        "external_id": 'ExternalId',
        "invoice_number": 'InvoiceNumber',
        "invoice_created_at": 'InvoiceCreatedAt',
        "invoice_date": 'InvoiceDate',
        "created_at": 'CreatedAt',
        "paid_at": 'PaidAt',
        "shipped_at": 'ShippedAt',
        "has_invoice": 'HasInvoice',
        "order_state_id": 'OrderStateId',
        "order_state_text": 'OrderStateText',
        "total_gross": 'TotalGross',
        "shop_name": 'ShopName',
        "can_create_auto_invoice": 'CanCreateAutoInvoice'
    }

    def __init__(self,
                 id=None,
                 external_id=None,
                 invoice_number=None,
                 invoice_created_at=None,
                 invoice_date=None,
                 created_at=None,
                 paid_at=None,
                 shipped_at=None,
                 has_invoice=None,
                 order_state_id=None,
                 order_state_text=None,
                 total_gross=None,
                 shop_name=None,
                 can_create_auto_invoice=None):
        """Constructor for the RechnungsdruckWebAppControllersApiOrder class"""

        # Initialize members of the class
        self.id = id
        self.external_id = external_id
        self.invoice_number = invoice_number
        self.invoice_created_at = APIHelper.RFC3339DateTime(invoice_created_at) if invoice_created_at else None
        self.invoice_date = APIHelper.RFC3339DateTime(invoice_date) if invoice_date else None
        self.created_at = APIHelper.RFC3339DateTime(created_at) if created_at else None
        self.paid_at = APIHelper.RFC3339DateTime(paid_at) if paid_at else None
        self.shipped_at = APIHelper.RFC3339DateTime(shipped_at) if shipped_at else None
        self.has_invoice = has_invoice
        self.order_state_id = order_state_id
        self.order_state_text = order_state_text
        self.total_gross = total_gross
        self.shop_name = shop_name
        self.can_create_auto_invoice = can_create_auto_invoice

    @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
        id = dictionary.get('Id')
        external_id = dictionary.get('ExternalId')
        invoice_number = dictionary.get('InvoiceNumber')
        invoice_created_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("InvoiceCreatedAt")).datetime if dictionary.get("InvoiceCreatedAt") else None
        invoice_date = APIHelper.RFC3339DateTime.from_value(dictionary.get("InvoiceDate")).datetime if dictionary.get("InvoiceDate") else None
        created_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("CreatedAt")).datetime if dictionary.get("CreatedAt") else None
        paid_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("PaidAt")).datetime if dictionary.get("PaidAt") else None
        shipped_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("ShippedAt")).datetime if dictionary.get("ShippedAt") else None
        has_invoice = dictionary.get('HasInvoice')
        order_state_id = dictionary.get('OrderStateId')
        order_state_text = dictionary.get('OrderStateText')
        total_gross = dictionary.get('TotalGross')
        shop_name = dictionary.get('ShopName')
        can_create_auto_invoice = dictionary.get('CanCreateAutoInvoice')

        # Return an object of this model
        return cls(id,
                   external_id,
                   invoice_number,
                   invoice_created_at,
                   invoice_date,
                   created_at,
                   paid_at,
                   shipped_at,
                   has_invoice,
                   order_state_id,
                   order_state_text,
                   total_gross,
                   shop_name,
                   can_create_auto_invoice)
