from django.db import models


class models_projects(models.Model):
    id_project = models.CharField(primary_key=True, max_length=16)
    project_last_modification_date = models.CharField(max_length=16)
    project_last_modification_user = models.CharField(max_length=16)
    project_denomination = models.CharField(max_length=200)
    project_sales_document = models.CharField(max_length=500)
    project_maturity = models.CharField(max_length=30)
    project_credibility = models.CharField(max_length=30)



    class Meta:
        db_table = 'table_projects' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records

class models_companies(models.Model):
    id_company = models.CharField(primary_key=True, max_length=16)
    company_last_modification_date = models.CharField(max_length=16)
    company_last_modification_user = models.CharField(max_length=16)
    company_all_company_id = models.CharField(max_length=200) # to get all existing company in a selectbox (in company_mobile.html for instance)
    company_name = models.CharField(max_length=60000)
    company_members_id = models.CharField(max_length=60000)
    company_projects_id = models.CharField(max_length=60000)
    company_addresses_id = models.CharField(max_length=60000)
    company_vat_number = models.CharField(max_length=200)
    company_type = models.CharField(max_length=200)
    company_head_quarter_address_id = models.CharField(max_length=16)


    class Meta:
        db_table = 'table_companies'

class models_contacts(models.Model):
    id_contact = models.CharField(primary_key=True, max_length=16)
    contact_last_modification_date = models.CharField(max_length=16)
    contact_last_modification_user = models.CharField(max_length=16)
    contact_all_contact_id = models.CharField(max_length=200)
    contact_language = models.CharField(max_length=20)
    contact_gender = models.CharField(max_length=20)
    contact_last_name = models.CharField(max_length=100)
    contact_first_name = models.CharField(max_length=100)
    contact_phone_1 = models.CharField(max_length=100)
    contact_phone_2 =  models.CharField(max_length=100)
    contact_email_1 =  models.CharField(max_length=500)
    contact_email_2 =  models.CharField(max_length=100)
    test = models.JSONField(max_length=500)
    #test = models.ManyToManyField(BDC, blank=True)

    #def __str__(self):
        #return (f"{self.first_name} {self.last_name}")

    class Meta:
        db_table = 'table_contacts' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records

class models_add_contacts(models.Model):
    id_contact = models.CharField(primary_key=True, max_length=50)
    language = models.CharField(max_length=20)
    gender = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    first_name = models.CharField(max_length=50)
    phone_1 = models.CharField(max_length=100)
    phone_2 =  models.CharField(max_length=100)
    email_1 =  models.CharField(max_length=500)
    email_2 =  models.CharField(max_length=100)
    test = models.JSONField(max_length=500)


    #def __str__(self):
        #return (f"{self.first_name} {self.last_name}")

    class Meta:
        db_table = 'table_contacts' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records

class models_products(models.Model):

    id_product = models.CharField(primary_key=True, max_length=50)
    product_last_modification_date = models.CharField(max_length=16)
    product_last_modification_user = models.CharField(max_length=16)
    product_category = models.CharField(max_length=200)
    product_reference = models.CharField(max_length=200)
    product_denomination = models.CharField(max_length=200)
    product_prix_achat = models.CharField(max_length=50)
    product_prix_vente = models.CharField(max_length=50)
    product_prix_location = models.CharField(max_length=100)
    product_poids =  models.CharField(max_length=100)
    product_volume =  models.CharField(max_length=500)
    product_dimensions =  models.CharField(max_length=100)
    product_consommation = models.JSONField(max_length=500)
    product_quantite_colis = models.JSONField(max_length=500)
    product_sous_traitant = models.JSONField(max_length=500)
    product_vat = models.CharField(max_length=3)


    #def __str__(self):
        #return self.product_denomination


    #def __str__(self):
        #return (f"{self.first_name} {self.last_name}")

    class Meta:
        db_table = 'table_products' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records

class models_sales_documents(models.Model):

    id_sales_documents = models.CharField(primary_key=True, max_length=16)
    sales_documents_denomination = models.CharField(max_length=200)
    sales_documents_last_modification_date = models.CharField(max_length=16)
    sales_documents_last_modification_user = models.CharField(max_length=16)

    sales_documents_rent_or_sale = models.CharField(max_length=5)
    sales_documents_expiration_date = models.CharField(max_length=20)

    sales_documents_timeline_step = models.CharField(max_length=20)

    sales_documents_quote_id = models.CharField(max_length=20)
    sales_documents_quote_number = models.CharField(max_length=20)
    sales_documents_purchase_order_id = models.CharField(max_length=20)
    sales_documents_purchase_order_number = models.CharField(max_length=20)
    sales_documents_delivery_note_id = models.CharField(max_length=20)
    sales_documents_delivery_note_number = models.CharField(max_length=20)
    sales_documents_invoice_id = models.CharField(max_length=20)
    sales_documents_invoice_number = models.CharField(max_length=20)

    sales_documents_ref_contact_id = models.CharField(max_length=200)
    sales_documents_billing_address_id = models.CharField(max_length=16)
    sales_documents_delivery_address_id = models.CharField(max_length=16)

    sales_documents_payment_conditions = models.CharField(max_length=200)
    sales_documents_payment_due_date = models.CharField(max_length=200)

    sales_documents_deposit_id = models.CharField(max_length=200)
    sales_documents_deposit_number = models.CharField(max_length=200)
    sales_documents_deposit_date = models.CharField(max_length=200)
    sales_documents_deposit_amount = models.CharField(max_length=200)
    sales_documents_deposit_method = models.CharField(max_length=200)

    sales_documents_index_line_1 = models.CharField(max_length=2)
    sales_documents_quantity_1 = models.CharField(max_length=4)
    sales_documents_description_1 = models.CharField(max_length=200)
    sales_documents_description_free_1 = models.CharField(max_length=200)
    sales_documents_price_1 = models.CharField(max_length=10)
    sales_documents_discount_1 = models.CharField(max_length=10)
    sales_documents_calculated_price_1 = models.CharField(max_length=100)
    sales_documents_discounted_price_1 = models.CharField(max_length=10)
    sales_documents_vat_1 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_2 = models.CharField(max_length=2)
    sales_documents_quantity_2 = models.CharField(max_length=4)
    sales_documents_description_2 =  models.CharField(max_length=200)
    sales_documents_description_free_2 =  models.CharField(max_length=200)
    sales_documents_price_2 =  models.CharField(max_length=10)
    sales_documents_discount_2 =  models.CharField(max_length=10)
    sales_documents_calculated_price_2 = models.CharField(max_length=100)
    sales_documents_discounted_price_2 = models.CharField(max_length=10)
    sales_documents_vat_2 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_3 = models.CharField(max_length=2)
    sales_documents_quantity_3 = models.CharField(max_length=4)
    sales_documents_description_3 = models.CharField(max_length=200)
    sales_documents_description_free_3 = models.CharField(max_length=200)
    sales_documents_price_3 = models.CharField(max_length=10)
    sales_documents_discount_3 = models.CharField(max_length=10)
    sales_documents_calculated_price_3 = models.CharField(max_length=100)
    sales_documents_discounted_price_3 = models.CharField(max_length=10)
    sales_documents_vat_3 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_4 = models.CharField(max_length=2)
    sales_documents_quantity_4 = models.CharField(max_length=4)
    sales_documents_description_4 = models.CharField(max_length=200)
    sales_documents_description_free_4 = models.CharField(max_length=200)
    sales_documents_price_4 = models.CharField(max_length=10)
    sales_documents_discount_4 = models.CharField(max_length=10)
    sales_documents_calculated_price_4 = models.CharField(max_length=100)
    sales_documents_discounted_price_4 = models.CharField(max_length=10)
    sales_documents_vat_4 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_5 = models.CharField(max_length=2)
    sales_documents_quantity_5 = models.CharField(max_length=4)
    sales_documents_description_5 = models.CharField(max_length=200)
    sales_documents_description_free_5 = models.CharField(max_length=200)
    sales_documents_price_5 = models.CharField(max_length=10)
    sales_documents_discount_5 = models.CharField(max_length=10)
    sales_documents_calculated_price_5 = models.CharField(max_length=100)
    sales_documents_discounted_price_5 = models.CharField(max_length=10)
    sales_documents_vat_5 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_6 = models.CharField(max_length=2)
    sales_documents_quantity_6 = models.CharField(max_length=4)
    sales_documents_description_6 = models.CharField(max_length=200)
    sales_documents_description_free_6 = models.CharField(max_length=200)
    sales_documents_price_6 = models.CharField(max_length=10)
    sales_documents_discount_6 = models.CharField(max_length=10)
    sales_documents_calculated_price_6 = models.CharField(max_length=100)
    sales_documents_discounted_price_6 = models.CharField(max_length=10)
    sales_documents_vat_6 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_7 = models.CharField(max_length=2)
    sales_documents_quantity_7 = models.CharField(max_length=4)
    sales_documents_description_7 = models.CharField(max_length=200)
    sales_documents_description_free_7 = models.CharField(max_length=200)
    sales_documents_price_7 = models.CharField(max_length=10)
    sales_documents_discount_7 = models.CharField(max_length=10)
    sales_documents_calculated_price_7 = models.CharField(max_length=100)
    sales_documents_discounted_price_7 = models.CharField(max_length=10)
    sales_documents_vat_7 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_8 = models.CharField(max_length=2)
    sales_documents_quantity_8 = models.CharField(max_length=4)
    sales_documents_description_8 = models.CharField(max_length=200)
    sales_documents_description_free_8 = models.CharField(max_length=200)
    sales_documents_price_8 = models.CharField(max_length=10)
    sales_documents_discount_8 = models.CharField(max_length=10)
    sales_documents_calculated_price_8 = models.CharField(max_length=100)
    sales_documents_discounted_price_8 = models.CharField(max_length=10)
    sales_documents_vat_8 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_9 = models.CharField(max_length=2)
    sales_documents_quantity_9 = models.CharField(max_length=4)
    sales_documents_description_9 = models.CharField(max_length=200)
    sales_documents_description_free_9 = models.CharField(max_length=200)
    sales_documents_price_9 = models.CharField(max_length=10)
    sales_documents_discount_9 = models.CharField(max_length=10)
    sales_documents_calculated_price_9 = models.CharField(max_length=100)
    sales_documents_discounted_price_9 = models.CharField(max_length=10)
    sales_documents_vat_9 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_10 = models.CharField(max_length=2)
    sales_documents_quantity_10 = models.CharField(max_length=4)
    sales_documents_description_10 = models.CharField(max_length=200)
    sales_documents_description_free_10 = models.CharField(max_length=200)
    sales_documents_price_10 = models.CharField(max_length=10)
    sales_documents_discount_10 = models.CharField(max_length=10)
    sales_documents_calculated_price_10 = models.CharField(max_length=100)
    sales_documents_discounted_price_10 = models.CharField(max_length=10)
    sales_documents_vat_10 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_11 = models.CharField(max_length=2)
    sales_documents_quantity_11 = models.CharField(max_length=4)
    sales_documents_description_11 = models.CharField(max_length=200)
    sales_documents_description_free_11 = models.CharField(max_length=200)
    sales_documents_price_11 = models.CharField(max_length=10)
    sales_documents_discount_11 = models.CharField(max_length=10)
    sales_documents_calculated_price_11 = models.CharField(max_length=100)
    sales_documents_discounted_price_11 = models.CharField(max_length=10)
    sales_documents_vat_11 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_12 = models.CharField(max_length=2)
    sales_documents_quantity_12 = models.CharField(max_length=4)
    sales_documents_description_12 = models.CharField(max_length=200)
    sales_documents_description_free_12 = models.CharField(max_length=200)
    sales_documents_price_12 = models.CharField(max_length=10)
    sales_documents_discount_12 = models.CharField(max_length=10)
    sales_documents_calculated_price_12 = models.CharField(max_length=100)
    sales_documents_discounted_price_12 = models.CharField(max_length=10)
    sales_documents_vat_12 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_13 = models.CharField(max_length=2)
    sales_documents_quantity_13 = models.CharField(max_length=4)
    sales_documents_description_13 = models.CharField(max_length=200)
    sales_documents_description_free_13 = models.CharField(max_length=200)
    sales_documents_price_13 = models.CharField(max_length=10)
    sales_documents_discount_13 = models.CharField(max_length=10)
    sales_documents_calculated_price_13 = models.CharField(max_length=100)
    sales_documents_discounted_price_13 = models.CharField(max_length=10)
    sales_documents_vat_13 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_14 = models.CharField(max_length=2)
    sales_documents_quantity_14 = models.CharField(max_length=4)
    sales_documents_description_14 = models.CharField(max_length=200)
    sales_documents_description_free_14 = models.CharField(max_length=200)
    sales_documents_price_14 = models.CharField(max_length=10)
    sales_documents_discount_14 = models.CharField(max_length=10)
    sales_documents_calculated_price_14 = models.CharField(max_length=100)
    sales_documents_discounted_price_14 = models.CharField(max_length=10)
    sales_documents_vat_14 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_15 = models.CharField(max_length=2)
    sales_documents_quantity_15 = models.CharField(max_length=4)
    sales_documents_description_15 = models.CharField(max_length=200)
    sales_documents_description_free_15 = models.CharField(max_length=200)
    sales_documents_price_15 = models.CharField(max_length=10)
    sales_documents_discount_15 = models.CharField(max_length=10)
    sales_documents_calculated_price_15 = models.CharField(max_length=100)
    sales_documents_discounted_price_15 = models.CharField(max_length=10)
    sales_documents_vat_15 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_16 = models.CharField(max_length=2)
    sales_documents_quantity_16 = models.CharField(max_length=4)
    sales_documents_description_16 = models.CharField(max_length=200)
    sales_documents_description_free_16 = models.CharField(max_length=200)
    sales_documents_price_16 = models.CharField(max_length=10)
    sales_documents_discount_16 = models.CharField(max_length=10)
    sales_documents_calculated_price_16 = models.CharField(max_length=100)
    sales_documents_discounted_price_16 = models.CharField(max_length=10)
    sales_documents_vat_16 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_17 = models.CharField(max_length=2)
    sales_documents_quantity_17 = models.CharField(max_length=4)
    sales_documents_description_17 = models.CharField(max_length=200)
    sales_documents_description_free_17 = models.CharField(max_length=200)
    sales_documents_price_17 = models.CharField(max_length=10)
    sales_documents_discount_17 = models.CharField(max_length=10)
    sales_documents_calculated_price_17 = models.CharField(max_length=100)
    sales_documents_discounted_price_17 = models.CharField(max_length=10)
    sales_documents_vat_17 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_18 = models.CharField(max_length=2)
    sales_documents_quantity_18 = models.CharField(max_length=4)
    sales_documents_description_18 = models.CharField(max_length=200)
    sales_documents_description_free_18 = models.CharField(max_length=200)
    sales_documents_price_18 = models.CharField(max_length=10)
    sales_documents_discount_18 = models.CharField(max_length=10)
    sales_documents_calculated_price_18 = models.CharField(max_length=100)
    sales_documents_discounted_price_18 = models.CharField(max_length=10)
    sales_documents_vat_18 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_19 = models.CharField(max_length=2)
    sales_documents_quantity_19 = models.CharField(max_length=4)
    sales_documents_description_19 = models.CharField(max_length=200)
    sales_documents_description_free_19 = models.CharField(max_length=200)
    sales_documents_price_19 = models.CharField(max_length=10)
    sales_documents_discount_19 = models.CharField(max_length=10)
    sales_documents_calculated_price_19 = models.CharField(max_length=100)
    sales_documents_discounted_price_19 = models.CharField(max_length=10)
    sales_documents_vat_19 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_20 = models.CharField(max_length=2)
    sales_documents_quantity_20 = models.CharField(max_length=4)
    sales_documents_description_20 = models.CharField(max_length=200)
    sales_documents_description_free_20 = models.CharField(max_length=200)
    sales_documents_price_20 = models.CharField(max_length=10)
    sales_documents_discount_20 = models.CharField(max_length=10)
    sales_documents_calculated_price_20 = models.CharField(max_length=100)
    sales_documents_discounted_price_20 = models.CharField(max_length=10)
    sales_documents_vat_20 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_21 = models.CharField(max_length=2)
    sales_documents_quantity_21 = models.CharField(max_length=4)
    sales_documents_description_21 = models.CharField(max_length=200)
    sales_documents_description_free_21 = models.CharField(max_length=200)
    sales_documents_price_21 = models.CharField(max_length=10)
    sales_documents_discount_21 = models.CharField(max_length=10)
    sales_documents_calculated_price_21 = models.CharField(max_length=100)
    sales_documents_discounted_price_21 = models.CharField(max_length=10)
    sales_documents_vat_21 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_22 = models.CharField(max_length=2)
    sales_documents_quantity_22 = models.CharField(max_length=4)
    sales_documents_description_22 = models.CharField(max_length=200)
    sales_documents_description_free_22 = models.CharField(max_length=200)
    sales_documents_price_22 = models.CharField(max_length=10)
    sales_documents_discount_22 = models.CharField(max_length=10)
    sales_documents_calculated_price_22 = models.CharField(max_length=100)
    sales_documents_discounted_price_22 = models.CharField(max_length=10)
    sales_documents_vat_22 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_23 = models.CharField(max_length=2)
    sales_documents_quantity_23 = models.CharField(max_length=4)
    sales_documents_description_23 = models.CharField(max_length=200)
    sales_documents_description_free_23 = models.CharField(max_length=200)
    sales_documents_price_23 = models.CharField(max_length=10)
    sales_documents_discount_23 = models.CharField(max_length=10)
    sales_documents_calculated_price_23 = models.CharField(max_length=100)
    sales_documents_discounted_price_23 = models.CharField(max_length=10)
    sales_documents_vat_23 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_24 = models.CharField(max_length=2)
    sales_documents_quantity_24 = models.CharField(max_length=4)
    sales_documents_description_24 = models.CharField(max_length=200)
    sales_documents_description_free_24 = models.CharField(max_length=200)
    sales_documents_price_24 = models.CharField(max_length=10)
    sales_documents_discount_24 = models.CharField(max_length=10)
    sales_documents_calculated_price_24 = models.CharField(max_length=100)
    sales_documents_discounted_price_24 = models.CharField(max_length=10)
    sales_documents_vat_24 = models.PositiveSmallIntegerField(default=0)
    
    sales_documents_index_line_25 = models.CharField(max_length=2)
    sales_documents_quantity_25 = models.CharField(max_length=4)
    sales_documents_description_25 = models.CharField(max_length=200)
    sales_documents_description_free_25 = models.CharField(max_length=200)
    sales_documents_price_25 = models.CharField(max_length=10)
    sales_documents_discount_25 = models.CharField(max_length=10)
    sales_documents_calculated_price_25 = models.CharField(max_length=100)
    sales_documents_discounted_price_25 = models.CharField(max_length=10)
    sales_documents_vat_25 = models.PositiveSmallIntegerField(default=0)
    
    





    #def __str__(self):
        #return (f"{self.first_name} {self.last_name}")

    class Meta:
        db_table = 'table_sales_documents' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records

class models_interactions(models.Model):
    id_interaction = models.CharField(primary_key=True, max_length=16)
    interaction_full_date = models.CharField(max_length=16)
    interaction_date = models.CharField(max_length=50)
    interaction_time = models.CharField(max_length=5)
    interaction_user = models.CharField(max_length=100)
    interaction_contact_id = models.CharField(max_length=16)
    interaction_company_id = models.CharField(max_length=5000)
    interaction_project_id = models.CharField(max_length=16)
    interaction_content = models.TextField(max_length=60000)
    interaction_type = models.CharField(max_length=20)
    interaction_mode = models.CharField(max_length=20)

    class Meta:
        db_table = 'table_interactions' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records


    #company_interactions_history = models.CharField(max_length=4000000)

class models_addresses(models.Model):
    id_address = models.CharField(primary_key=True, max_length=16)
    address_last_modification_date = models.CharField(max_length=16)
    address_last_modification_user = models.CharField(max_length=16)
    address_title = models.CharField(max_length=200)
    address_type = models.CharField(max_length=200)
    address_number = models.CharField(max_length=20)
    address_street_name_1 = models.CharField(max_length=1000)
    address_street_name_2 = models.CharField(max_length=1000)
    address_floor = models.CharField(max_length=20)
    address_postal_code = models.CharField(max_length=20)
    address_city = models.CharField(max_length=1000)
    address_country = models.CharField(max_length=1000)
    address_digicode_1 = models.CharField(max_length=20)
    address_digicode_2 = models.CharField(max_length=20)

    class Meta:
        db_table = 'table_addresses' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records

class models_alerts(models.Model):
    id_alert = models.CharField(primary_key=True, max_length=16)
    alert_last_modification_date = models.CharField(max_length=16)
    alert_last_modification_user = models.CharField(max_length=16)
    alert_date = models.CharField(max_length=16)
    alert_content = models.TextField(max_length=60000)
    alert_contact_id = models.CharField(max_length=16)
    alert_project_id = models.CharField(max_length=16)


    class Meta:
        db_table = 'table_alerts' #to authorise use of a custom DB name. Otherwise the db name as to be name-of-the-foler_name-of-model  so normally something like apps_files_records