"""
Django models for Grazuri schema compatibility.

This file contains complete Django models for all 62 tables that exist in the
Grazuri schema but are missing from the current Django system.

Auto-generated from xygbfpsg_loans.sql
Created as part of the Haven Grazuri Investment Limited rebranding migration.
"""

from django.db import models
from django.contrib.auth import get_user_model

User = get_user_model()


class Aboutus(models.Model):
    """Aboutus model for Grazuri schema compatibility"""
    abid = models.AutoField(primary_key=True)
    about = models.TextField()

    class Meta:
        db_table = 'aboutus'
        verbose_name = 'Aboutus'
        verbose_name_plural = 'Aboutuss'

    def __str__(self):
        return f'Aboutus instance'


class AdditionalFees(models.Model):
    """AdditionalFees model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    get_id = models.CharField(max_length=200)
    tid = models.CharField(max_length=200)
    fee = models.CharField(max_length=200)
    amount = models.CharField(max_length=200, db_column='Amount')

    class Meta:
        db_table = 'additional_fees'
        verbose_name = 'AdditionalFees'
        verbose_name_plural = 'AdditionalFeess'

    def __str__(self):
        return f'AdditionalFees #{self.id}'


class AffordabilityCheck(models.Model):
    """AffordabilityCheck model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    provider = models.CharField(max_length=100, null=True, blank=True)
    endpoint = models.CharField(max_length=100, null=True, blank=True)
    username = models.CharField(max_length=50, null=True, blank=True)
    password = models.CharField(max_length=50, null=True, blank=True)
    status = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'affordability_check'
        verbose_name = 'AffordabilityCheck'
        verbose_name_plural = 'AffordabilityChecks'

    def __str__(self):
        return f'AffordabilityCheck #{self.id}'


class Attachment(models.Model):
    """Attachment model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    get_id = models.CharField(max_length=200)
    tid = models.CharField(max_length=200)
    attached_file = models.TextField()
    date_time = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'attachment'
        verbose_name = 'Attachment'
        verbose_name_plural = 'Attachments'

    def __str__(self):
        return f'Attachment #{self.id}'


class B2cpaymentsresults(models.Model):
    """B2cpaymentsresults model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    merchant_loan_ref = models.CharField(max_length=50, null=True, blank=True, default=0, db_column='MerchantLoanRef')
    sasa_pay_ref = models.CharField(max_length=50, null=True, blank=True, default=0, db_column='SasaPayRef')
    m_pesa_ref = models.CharField(max_length=50, null=True, blank=True, default=0, db_column='MPesaRef')
    result_code = models.IntegerField(null=True, blank=True, default=0, db_column='ResultCode')
    result_desc = models.TextField(null=True, blank=True, db_column='ResultDesc')
    trans_amount = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True, default=0.00, db_column='TransAmount')
    sasa_pay_acc_balance = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True, default=0.00, db_column='SasaPayAccBalance')
    transaction_date = models.DateField(null=True, blank=True, db_column='TransactionDate')

    class Meta:
        db_table = 'b2cpaymentsresults'
        verbose_name = 'B2cpaymentsresults'
        verbose_name_plural = 'B2cpaymentsresultss'

    def __str__(self):
        return f'B2cpaymentsresults #{self.id}'


class Backup(models.Model):
    """Backup model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    tracking_id = models.CharField(max_length=200)
    amount = models.CharField(max_length=200)
    address = models.TextField()
    date_time = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'backup'
        verbose_name = 'Backup'
        verbose_name_plural = 'Backups'

    def __str__(self):
        return f'Backup #{self.id}'


class BankAccounts(models.Model):
    """BankAccounts model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    bank_name = models.CharField(max_length=50, null=True, blank=True, db_column='bankName')
    account_number = models.BigIntegerField(null=True, blank=True, db_column='accountNumber')
    balance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    transaction_type = models.CharField(max_length=20, db_column='transactionType')
    gl_code = models.CharField(max_length=10)
    source_gl_code = models.CharField(max_length=50)

    class Meta:
        db_table = 'bank_accounts'
        verbose_name = 'BankAccounts'
        verbose_name_plural = 'BankAccountss'

    def __str__(self):
        return f'BankAccounts #{self.id}'


class Banner(models.Model):
    """Banner model for Grazuri schema compatibility"""
    banaid = models.AutoField(primary_key=True)
    bannar = models.TextField()

    class Meta:
        db_table = 'banner'
        verbose_name = 'Banner'
        verbose_name_plural = 'Banners'

    def __str__(self):
        return f'Banner instance'


class Basic(models.Model):
    """Basic model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    borrower = models.IntegerField(null=True, blank=True)
    basic_pay = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    additional_fixed_allowance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    gross_pay = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    statutory_deductions = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    loan_instalments = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    net_pay = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    other_bank_loans = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    monthly_living_expenses = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    max_available = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)

    class Meta:
        db_table = 'basic'
        verbose_name = 'Basic'
        verbose_name_plural = 'Basics'

    def __str__(self):
        return f'Basic #{self.id}'


class Battachment(models.Model):
    """Battachment model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    get_id = models.CharField(max_length=200)
    tid = models.CharField(max_length=200)
    attached_file = models.TextField()
    date_time = models.DateTimeField(auto_now_add=True)
    document_type = models.CharField(max_length=50, null=True, blank=True)
    file_size = models.CharField(max_length=50, null=True, blank=True)
    file_ext = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'battachment'
        verbose_name = 'Battachment'
        verbose_name_plural = 'Battachments'

    def __str__(self):
        return f'Battachment #{self.id}'


class Borrowers(models.Model):
    """Borrowers model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    fname = models.CharField(max_length=200)
    middlename = models.CharField(max_length=50)
    lname = models.CharField(max_length=200)
    email = models.CharField(max_length=200, null=True, blank=True)
    phone = models.CharField(max_length=200, null=True, blank=True)
    telephone = models.CharField(max_length=50, default='')
    addrs1 = models.TextField()
    addrs2 = models.TextField()
    district = models.CharField(max_length=200)
    country = models.CharField(max_length=200)
    comment = models.TextField(null=True, blank=True)
    account = models.CharField(max_length=200)
    image = models.CharField(max_length=200, null=True, blank=True)
    date_time = models.DateTimeField(auto_now_add=True)
    status = models.CharField(max_length=200)
    date_of_birth = models.DateField(null=True, blank=True)
    gender = models.CharField(max_length=10, null=True, blank=True)
    id_number = models.CharField(max_length=25, null=True, blank=True)
    passport = models.CharField(max_length=50, null=True, blank=True)
    credit_score = models.CharField(max_length=25, null=True, blank=True)
    employment_status = models.CharField(max_length=25, null=True, blank=True)
    employer = models.CharField(max_length=50, null=True, blank=True)
    title = models.CharField(max_length=50, null=True, blank=True)
    created_by = models.CharField(max_length=50, null=True, blank=True)
    modified_by = models.CharField(max_length=50, null=True, blank=True)
    balance = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    emp_code = models.CharField(max_length=50, null=True, blank=True)
    salary = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    disposable_income = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    occupation = models.CharField(max_length=50, null=True, blank=True)
    modified_on = models.DateTimeField(null=True, blank=True)
    postal = models.IntegerField(null=True, blank=True)
    ownership_type = models.CharField(max_length=10, null=True, blank=True, db_column='ownershipType')
    member = models.BooleanField(default=False)
    marital = models.CharField(max_length=30)
    marriage_type = models.CharField(max_length=30, db_column='marriageType')

    class Meta:
        db_table = 'borrowers'
        verbose_name = 'Borrowers'
        verbose_name_plural = 'Borrowerss'

    def __str__(self):
        return f'Borrowers #{self.id}'


class BorrowersSalaries(models.Model):
    """BorrowersSalaries model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    borrower = models.IntegerField(null=True, blank=True)
    basic_pay = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    additional_fixed_allowance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    gross_pay = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    statutory_deductions = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    loan_instalments = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    net_pay = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    other_bank_loans = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    monthly_living_expenses = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    max_available = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)

    class Meta:
        db_table = 'borrowers_salaries'
        verbose_name = 'BorrowersSalaries'
        verbose_name_plural = 'BorrowersSalariess'

    def __str__(self):
        return f'BorrowersSalaries #{self.id}'


class Branches(models.Model):
    """Branches model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50, null=True, blank=True)
    location = models.CharField(max_length=50, null=True, blank=True)
    code = models.CharField(max_length=10, null=True, blank=True)
    status = models.CharField(max_length=50, null=True, blank=True)
    sub_account = models.IntegerField(null=True, blank=True)

    class Meta:
        db_table = 'branches'
        verbose_name = 'Branches'
        verbose_name_plural = 'Branchess'

    def __str__(self):
        return f'Branches #{self.id}'


class BureauRecords(models.Model):
    """BureauRecords model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    batch = models.IntegerField(default=0)
    borrower = models.IntegerField(default=0)
    id_number = models.CharField(max_length=25, null=True, blank=True)
    passport = models.CharField(max_length=50, null=True, blank=True)
    baccount = models.CharField(max_length=200)
    district = models.CharField(max_length=200)
    country = models.CharField(max_length=200)
    reason = models.TextField()
    bureau_account_type = models.CharField(max_length=10, db_column='bureauAccountType')
    modified_date = models.DateTimeField(null=True, blank=True)
    ownership_type = models.CharField(max_length=10, null=True, blank=True, db_column='ownershipType')
    lname = models.CharField(max_length=200)
    fname = models.CharField(max_length=200)
    gender = models.CharField(max_length=10, null=True, blank=True)
    phone = models.CharField(max_length=200, null=True, blank=True)
    employer = models.CharField(max_length=50)
    application_date = models.DateTimeField(null=True, blank=True)
    balance = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    loan_repayment_method = models.CharField(max_length=10, null=True, blank=True)
    loan_payment_scheme = models.CharField(max_length=200)
    postal = models.IntegerField(null=True, blank=True)
    ownership_type = models.CharField(max_length=10, null=True, blank=True)
    amount_topay = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    loan_duration = models.CharField(max_length=50, default=0)
    loan_duration_period = models.CharField(max_length=200)
    status = models.CharField(max_length=200)
    date_of_birth = models.DateField(null=True, blank=True)
    branch = models.CharField(max_length=50, null=True, blank=True)
    title = models.CharField(max_length=50, null=True, blank=True)
    addrs2 = models.TextField()
    addrs1 = models.TextField()

    class Meta:
        db_table = 'bureau_records'
        verbose_name = 'BureauRecords'
        verbose_name_plural = 'BureauRecordss'

    def __str__(self):
        return f'BureauRecords #{self.id}'


class BureauSubmissions(models.Model):
    """BureauSubmissions model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    batch = models.IntegerField(null=True, blank=True)
    loan_records = models.IntegerField(null=True, blank=True)
    status = models.CharField(max_length=50, null=True, blank=True, default='Scheduled')
    action_date = models.DateTimeField(null=True, blank=True)
    action_by = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'bureau_submissions'
        verbose_name = 'BureauSubmissions'
        verbose_name_plural = 'BureauSubmissionss'

    def __str__(self):
        return f'BureauSubmissions #{self.id}'


class Collateral(models.Model):
    """Collateral model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    idm = models.CharField(max_length=200)
    tid = models.CharField(max_length=200)
    name = models.CharField(max_length=200)
    type_of_collateral = models.CharField(max_length=200)
    model = models.CharField(max_length=200)
    make = models.CharField(max_length=200)
    serial_number = models.CharField(max_length=200)
    estimated_price = models.CharField(max_length=200)
    proof_of_ownership = models.TextField()
    cimage = models.TextField()
    observation = models.TextField()
    loan = models.IntegerField(null=True, blank=True)

    class Meta:
        db_table = 'collateral'
        verbose_name = 'Collateral'
        verbose_name_plural = 'Collaterals'

    def __str__(self):
        return f'Collateral #{self.id}'


class Comments(models.Model):
    """Comments model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    tid = models.CharField(max_length=55)
    comment = models.TextField()
    date = models.DateTimeField(auto_now_add=True)
    account = models.CharField(max_length=100)
    customer = models.CharField(max_length=100)

    class Meta:
        db_table = 'comments'
        verbose_name = 'Comments'
        verbose_name_plural = 'Commentss'

    def __str__(self):
        return f'Comments #{self.id}'


class Countries(models.Model):
    """Countries model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50, default='')
    alpha_2 = models.CharField(max_length=200, default='')
    alpha_3 = models.CharField(max_length=200, default='')

    class Meta:
        db_table = 'countries'
        verbose_name = 'Countries'
        verbose_name_plural = 'Countriess'

    def __str__(self):
        return f'Countries #{self.id}'


class DocumentsRequired(models.Model):
    """DocumentsRequired model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50, null=True, blank=True)
    status = models.CharField(max_length=10, null=True, blank=True)

    class Meta:
        db_table = 'documents_required'
        verbose_name = 'DocumentsRequired'
        verbose_name_plural = 'DocumentsRequireds'

    def __str__(self):
        return f'DocumentsRequired #{self.id}'


class EmpPermission(models.Model):
    """EmpPermission model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    tid = models.CharField(max_length=200)
    module_name = models.CharField(max_length=350)
    pcreate = models.CharField(max_length=20)
    pread = models.CharField(max_length=20)
    pupdate = models.CharField(max_length=20)
    pdelete = models.CharField(max_length=20)

    class Meta:
        db_table = 'emp_permission'
        verbose_name = 'EmpPermission'
        verbose_name_plural = 'EmpPermissions'

    def __str__(self):
        return f'EmpPermission #{self.id}'


class EmpRole(models.Model):
    """EmpRole model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    role = models.CharField(max_length=200)

    class Meta:
        db_table = 'emp_role'
        verbose_name = 'EmpRole'
        verbose_name_plural = 'EmpRoles'

    def __str__(self):
        return f'EmpRole #{self.id}'


class EmployerDetails(models.Model):
    """EmployerDetails model for Grazuri schema compatibility"""
    id = models.IntegerField()
    employee_no = models.BigIntegerField(null=True, blank=True)
    employer_name = models.CharField(max_length=30)
    department = models.CharField(max_length=50)
    employer_code = models.CharField(max_length=12, null=True, blank=True)
    designation = models.CharField(max_length=30)
    engagement_date = models.DateField(null=True, blank=True)
    employment_status = models.CharField(max_length=30)
    retirement = models.DateField(null=True, blank=True)
    employer_contact = models.BigIntegerField(null=True, blank=True)
    telephone = models.IntegerField(null=True, blank=True)
    employer_designation = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'employer_details'
        verbose_name = 'EmployerDetails'
        verbose_name_plural = 'EmployerDetailss'

    def __str__(self):
        return f'EmployerDetails #{self.id}'


class ETemplates(models.Model):
    """ETemplates model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    sender = models.CharField(max_length=200)
    receiver_email = models.CharField(max_length=350)
    subject = models.CharField(max_length=350)
    msg = models.TextField()
    time_date = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'etemplates'
        verbose_name = 'ETemplates'
        verbose_name_plural = 'ETemplatess'

    def __str__(self):
        return f'ETemplates #{self.id}'


class FAQs(models.Model):
    """FAQs model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    topic = models.TextField()
    content = models.TextField()

    class Meta:
        db_table = 'faqs'
        verbose_name = 'FAQs'
        verbose_name_plural = 'FAQss'

    def __str__(self):
        return f'FAQs #{self.id}'


class FinInfo(models.Model):
    """FinInfo model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    get_id = models.CharField(max_length=200)
    tid = models.CharField(max_length=200)
    occupation = models.CharField(max_length=25)
    mincome = models.CharField(max_length=200)
    frequency = models.CharField(max_length=10, null=True, blank=True)

    class Meta:
        db_table = 'fin_info'
        verbose_name = 'FinInfo'
        verbose_name_plural = 'FinInfos'

    def __str__(self):
        return f'FinInfo #{self.id}'


class Footer(models.Model):
    """Footer model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    email = models.CharField(max_length=200)
    pho = models.CharField(max_length=200)
    face = models.CharField(max_length=200)
    webs = models.CharField(max_length=200)
    conh = models.CharField(max_length=200)
    twi = models.CharField(max_length=200)
    gplus = models.CharField(max_length=200)
    ins = models.CharField(max_length=200)
    yous = models.CharField(max_length=200)
    about = models.TextField()
    apply = models.TextField()
    mission = models.TextField()
    objective = models.TextField()
    map = models.TextField()

    class Meta:
        db_table = 'footer'
        verbose_name = 'Footer'
        verbose_name_plural = 'Footers'

    def __str__(self):
        return f'Footer #{self.id}'


class GlCodes(models.Model):
    """GlCodes model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    code = models.CharField(max_length=50)
    name = models.CharField(max_length=100, null=True, blank=True)
    type_field = models.CharField(max_length=50, null=True, blank=True, db_column='type')
    portfolio = models.CharField(max_length=50, null=True, blank=True)
    balance = models.DecimalField(max_digits=16, decimal_places=2)

    class Meta:
        db_table = 'gl_codes'
        verbose_name = 'GlCodes'
        verbose_name_plural = 'GlCodess'

    def __str__(self):
        return f'GlCodes #{self.id}'


class HIW(models.Model):
    """HIW model for Grazuri schema compatibility"""
    hid = models.AutoField(primary_key=True)
    hiw = models.TextField()

    class Meta:
        db_table = 'hiw'
        verbose_name = 'HIW'
        verbose_name_plural = 'HIWs'

    def __str__(self):
        return f'HIW instance'


class JournalTransactions(models.Model):
    """JournalTransactions model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    date = models.DateTimeField(null=True, blank=True)
    account = models.BigIntegerField(null=True, blank=True)
    transaction = models.CharField(max_length=50, null=True, blank=True)
    opening_balance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    debit = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    credit = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    balance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    agent = models.CharField(max_length=50, null=True, blank=True)
    tx_id = models.CharField(max_length=50, null=True, blank=True)
    notes = models.CharField(max_length=50, null=True, blank=True)
    filename = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'journal_transactions'
        verbose_name = 'JournalTransactions'
        verbose_name_plural = 'JournalTransactionss'

    def __str__(self):
        return f'JournalTransactions #{self.id}'


class LoanAdditionalSettings(models.Model):
    """LoanAdditionalSettings model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    fee_description = models.CharField(max_length=50, null=True, blank=True)
    percentage = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    fixed_amount = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    is_penalty = models.IntegerField(null=True, blank=True)
    is_initial_deduction = models.IntegerField(null=True, blank=True)

    class Meta:
        db_table = 'loan_additional_settings'
        verbose_name = 'LoanAdditionalSettings'
        verbose_name_plural = 'LoanAdditionalSettingss'

    def __str__(self):
        return f'LoanAdditionalSettings #{self.id}'


class LoanDisbursements(models.Model):
    """LoanDisbursements model for Grazuri schema compatibility"""
    pay_id = models.AutoField(primary_key=True)
    loan = models.IntegerField(null=True, blank=True)
    date = models.DateTimeField(auto_now_add=True)
    transaction = models.CharField(max_length=200)
    disbursement_method = models.CharField(max_length=50)

    class Meta:
        db_table = 'loan_disbursements'
        verbose_name = 'LoanDisbursements'
        verbose_name_plural = 'LoanDisbursementss'

    def __str__(self):
        return f'LoanDisbursements instance'


class LoanFees(models.Model):
    """LoanFees model for Grazuri schema compatibility"""
    loan_fees_id = models.AutoField(primary_key=True)
    fee_name = models.CharField(max_length=50, null=True, blank=True)
    fee_amount = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    loan = models.IntegerField(null=True, blank=True)
    date_added = models.DateTimeField(null=True, blank=True)
    added_by = models.CharField(max_length=50, null=True, blank=True)
    gl_code = models.CharField(max_length=20)
    status = models.CharField(max_length=20)

    class Meta:
        db_table = 'loan_fees'
        verbose_name = 'LoanFees'
        verbose_name_plural = 'LoanFeess'

    def __str__(self):
        return f'LoanFees instance'


class LoanFeesSettings(models.Model):
    """LoanFeesSettings model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    fee_name = models.CharField(max_length=50)
    fee_amount = models.DecimalField(max_digits=16, decimal_places=2)
    min_loan = models.DecimalField(max_digits=16, decimal_places=2)
    max_loan = models.DecimalField(max_digits=16, decimal_places=2)
    deductible = models.CharField()
    active_status = models.BooleanField(default=False)

    class Meta:
        db_table = 'loan_fees_settings'
        verbose_name = 'LoanFeesSettings'
        verbose_name_plural = 'LoanFeesSettingss'

    def __str__(self):
        return f'LoanFeesSettings #{self.id}'


class LoanFeespayments(models.Model):
    """LoanFeespayments model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    loan_fees_id = models.IntegerField()
    loan_id = models.IntegerField()
    loanaccount = models.CharField(max_length=50, default='')
    trxno = models.CharField(max_length=50, default='')
    paymentref = models.CharField(max_length=50, default='')
    amount = models.DecimalField(max_digits=16, decimal_places=2)
    date_added = models.DateTimeField()
    added_by = models.CharField(max_length=50, default='')
    gl_code = models.CharField(max_length=50, default='')

    class Meta:
        db_table = 'loan_feespayments'
        verbose_name = 'LoanFeespayments'
        verbose_name_plural = 'LoanFeespaymentss'

    def __str__(self):
        return f'LoanFeespayments #{self.id}'


class LoanGuarantors(models.Model):
    """LoanGuarantors model for Grazuri schema compatibility"""
    guarantor_id = models.AutoField(primary_key=True)
    borrower = models.IntegerField(default=0)
    loan_id = models.IntegerField(default=0)
    name = models.CharField(max_length=100, default='')
    relationship = models.CharField(max_length=100, default='')
    phone = models.CharField(max_length=50, default='')
    status = models.CharField(max_length=50, default='')
    remarks = models.CharField(max_length=50, default='')
    image = models.CharField()
    address = models.CharField(max_length=100, null=True, blank=True)

    class Meta:
        db_table = 'loan_guarantors'
        verbose_name = 'LoanGuarantors'
        verbose_name_plural = 'LoanGuarantorss'

    def __str__(self):
        return f'LoanGuarantors instance'


class LoanInfo(models.Model):
    """LoanInfo model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    borrower = models.IntegerField(default=0)
    baccount = models.CharField(max_length=200)
    reason = models.TextField()
    amount = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    application_date = models.DateTimeField(null=True, blank=True)
    agent = models.CharField(max_length=200)
    loan_product = models.TextField()
    repayment_remark = models.CharField(max_length=200)
    amount_todisburse = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    amount_intrestatuodeducted = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    amount_topay = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    pay_date = models.DateField(null=True, blank=True)
    balance = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    teller = models.CharField(max_length=200)
    status = models.CharField(max_length=200)
    disbursement_status = models.CharField(max_length=200)
    loan_num_of_repayments = models.CharField(max_length=200)
    loan_payment_scheme = models.CharField(max_length=200)
    loan_duration_period = models.CharField(max_length=200)
    loan_duration = models.CharField(max_length=50, default=0)
    loan_interest_period = models.CharField(max_length=200)
    loan_interest = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    loan_interest_type = models.CharField(max_length=200)
    loan_interest_method = models.CharField(max_length=200)
    date_release = models.DateField(null=True, blank=True)
    loan_disbursed_by_id = models.CharField(max_length=200)
    upstatus = models.CharField(max_length=50, null=True, blank=True)
    loan_maturity = models.DateField(null=True, blank=True)
    modified_date = models.DateTimeField(null=True, blank=True)
    modified_by = models.CharField(max_length=50, null=True, blank=True)
    fees = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    branch = models.CharField(max_length=50, null=True, blank=True)
    loan_repayment_method = models.CharField(max_length=10, null=True, blank=True)
    ownership_type = models.CharField(max_length=10, null=True, blank=True)
    payment_reference = models.CharField(max_length=50, null=True, blank=True)
    status_reason = models.CharField(max_length=100, null=True, blank=True)
    disbursed_amount = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    interest_value = models.DecimalField(max_digits=16, decimal_places=2)
    bureau_account_type = models.CharField(max_length=10, db_column='bureauAccountType')
    gl_code = models.CharField(max_length=20)
    resch = models.IntegerField(default=0, db_column='Resch')

    class Meta:
        db_table = 'loan_info'
        verbose_name = 'LoanInfo'
        verbose_name_plural = 'LoanInfos'

    def __str__(self):
        return f'LoanInfo #{self.id}'


class LoanRescheduleTable(models.Model):
    """LoanRescheduleTable model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    original_loan_no = models.CharField(max_length=65)
    new_loan_no = models.CharField(max_length=65)
    borrower_id = models.IntegerField()
    original_loan_balance = models.DecimalField(max_digits=12, decimal_places=2)
    fine_charged = models.DecimalField(max_digits=12, decimal_places=2)
    payable_intrest = models.IntegerField()
    new_loan_balance = models.DecimalField(max_digits=12, decimal_places=2)
    Payable_instalments = models.DecimalField(max_digits=12, decimal_places=2)
    repayment_cycle = models.TextField()
    loan_officer = models.TextField()
    approving_officer_1 = models.TextField()
    approving_officer_1_idno = models.CharField(max_length=100)
    approving_officer_2 = models.TextField()
    approving_officer_2_idno = models.CharField(max_length=100)
    Resch_date = models.DateField()

    class Meta:
        db_table = 'loan_reschedule_table'
        verbose_name = 'LoanRescheduleTable'
        verbose_name_plural = 'LoanRescheduleTables'

    def __str__(self):
        return f'LoanRescheduleTable #{self.id}'


class LoanSettings(models.Model):
    """LoanSettings model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    interest_rate = models.DecimalField(null=True, blank=True)
    minimum_loan = models.IntegerField(null=True, blank=True)
    maximum_loan = models.IntegerField(null=True, blank=True)
    default_duration = models.IntegerField(null=True, blank=True)
    payment_cycle = models.CharField(max_length=50, null=True, blank=True)
    interest_method = models.CharField(max_length=50, null=True, blank=True)
    loan_insurance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    collateral = models.CharField(max_length=10, null=True, blank=True)
    minimum_loan_collateral = models.IntegerField(null=True, blank=True)
    penalty_fees = models.IntegerField(null=True, blank=True)

    class Meta:
        db_table = 'loan_settings'
        verbose_name = 'LoanSettings'
        verbose_name_plural = 'LoanSettingss'

    def __str__(self):
        return f'LoanSettings #{self.id}'


class LoanStatuses(models.Model):
    """LoanStatuses model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    status = models.CharField(max_length=50, null=True, blank=True)
    added_by = models.CharField(max_length=50, null=True, blank=True)
    added_date = models.DateTimeField(null=True, blank=True, auto_now_add=True)
    loan = models.IntegerField(null=True, blank=True)
    reason = models.CharField(max_length=100, null=True, blank=True)

    class Meta:
        db_table = 'loan_statuses'
        verbose_name = 'LoanStatuses'
        verbose_name_plural = 'LoanStatusess'

    def __str__(self):
        return f'LoanStatuses #{self.id}'


class Loanfees(models.Model):
    """Loanfees model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    loan_fees = models.CharField(null=True, blank=True)
    insurance_on_total_loan = models.IntegerField(null=True, blank=True)

    class Meta:
        db_table = 'loanfees'
        verbose_name = 'Loanfees'
        verbose_name_plural = 'Loanfeess'

    def __str__(self):
        return f'Loanfees #{self.id}'


class Loanprocessingfeesx(models.Model):
    """Loanprocessingfeesx model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    custacc = models.CharField(max_length=50, default='')
    trx_no = models.CharField(max_length=50, default='', db_column='TrxNo')
    payment_ref = models.CharField(max_length=50, default='', db_column='paymentRef')
    loan_no = models.CharField(max_length=50, null=True, blank=True, default='', db_column='loanNo')

    class Meta:
        db_table = 'loanprocessingfeesx'
        verbose_name = 'Loanprocessingfeesx'
        verbose_name_plural = 'Loanprocessingfeesxs'

    def __str__(self):
        return f'Loanprocessingfeesx #{self.id}'


class Message(models.Model):
    """Message model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    sender_id = models.CharField(max_length=200)
    sender_name = models.CharField(max_length=200)
    msg_to = models.CharField(max_length=200)
    subject = models.CharField(max_length=300)
    message = models.TextField()
    date_time = models.DateTimeField(auto_now_add=True)
    status = models.CharField(null=True, blank=True, default=0)

    class Meta:
        db_table = 'message'
        verbose_name = 'Message'
        verbose_name_plural = 'Messages'

    def __str__(self):
        return f'Message #{self.id}'


class Mywallet(models.Model):
    """Mywallet model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    tid = models.CharField(max_length=200)
    t_to = models.CharField(max_length=200)
    amount = models.CharField(max_length=200, db_column='Amount')
    desc = models.CharField(max_length=200, db_column='Desc')
    wtype = models.CharField(max_length=200)
    tdate = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'mywallet'
        verbose_name = 'Mywallet'
        verbose_name_plural = 'Mywallets'

    def __str__(self):
        return f'Mywallet #{self.id}'


class NextOfKinDetails(models.Model):
    """NextOfKinDetails model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    borrower = models.IntegerField(null=True, blank=True)
    names = models.CharField(max_length=50, null=True, blank=True)
    address = models.CharField(max_length=50, null=True, blank=True)
    contact = models.CharField(max_length=50, null=True, blank=True)
    email = models.CharField(max_length=50, null=True, blank=True)
    employer = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'next_of_kin_details'
        verbose_name = 'NextOfKinDetails'
        verbose_name_plural = 'NextOfKinDetailss'

    def __str__(self):
        return f'NextOfKinDetails #{self.id}'


class PaySchedule(models.Model):
    """PaySchedule model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    get_id = models.CharField(max_length=200)
    tid = models.CharField(max_length=200)
    schedule = models.CharField(max_length=200)
    balance = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    interest = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    payment = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    principal_due = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    pay_type = models.CharField(max_length=50, null=True, blank=True)
    fees = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    total_due = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    principal_payment = models.DecimalField(max_digits=16, decimal_places=2)
    interest_payment = models.DecimalField(max_digits=16, decimal_places=2)
    fees_payment = models.DecimalField(max_digits=16, decimal_places=2)
    open_indicator = models.CharField(max_length=1)
    penalty = models.DecimalField(max_digits=16, decimal_places=2)
    penalty_payment = models.DecimalField(max_digits=16, decimal_places=2)
    payment_tx_id = models.CharField(max_length=20)

    class Meta:
        db_table = 'pay_schedule'
        verbose_name = 'PaySchedule'
        verbose_name_plural = 'PaySchedules'

    def __str__(self):
        return f'PaySchedule #{self.id}'


class PaymentSchedule(models.Model):
    """PaymentSchedule model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    idm = models.CharField(max_length=200)
    tid = models.CharField(max_length=200)
    term = models.CharField(max_length=200)
    day = models.CharField(max_length=200)
    schedule = models.CharField(max_length=200)
    interest = models.CharField(max_length=200)
    penalty = models.CharField(max_length=200)

    class Meta:
        db_table = 'payment_schedule'
        verbose_name = 'PaymentSchedule'
        verbose_name_plural = 'PaymentSchedules'

    def __str__(self):
        return f'PaymentSchedule #{self.id}'


class Paymenterrors(models.Model):
    """Paymenterrors model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    paymenterror = models.TextField()

    class Meta:
        db_table = 'paymenterrors'
        verbose_name = 'Paymenterrors'
        verbose_name_plural = 'Paymenterrorss'

    def __str__(self):
        return f'Paymenterrors #{self.id}'


class Payments(models.Model):
    """Payments model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    tid = models.CharField(max_length=200)
    account = models.CharField(max_length=200)
    balance = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    customer = models.CharField(max_length=200)
    loan = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    pay_date = models.DateTimeField(auto_now_add=True)
    amount_to_pay = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    remarks = models.TextField()
    payment_method = models.CharField(max_length=50, null=True, blank=True)
    reference = models.CharField(max_length=50, null=True, blank=True)
    tr_id = models.CharField(max_length=20)
    gl_code = models.CharField(max_length=20)
    status = models.CharField(max_length=10, default='C')

    class Meta:
        db_table = 'payments'
        verbose_name = 'Payments'
        verbose_name_plural = 'Paymentss'

    def __str__(self):
        return f'Payments #{self.id}'


class Products(models.Model):
    """Products model for Grazuri schema compatibility"""
    product_id = models.AutoField(primary_key=True)
    product_name = models.CharField(max_length=50)
    product_type = models.CharField(max_length=50)
    account_type = models.CharField(max_length=10, db_column='accountType')
    product_configuration = models.TextField()

    class Meta:
        db_table = 'products'
        verbose_name = 'Products'
        verbose_name_plural = 'Productss'

    def __str__(self):
        return f'Products instance'


class ReversedPayments(models.Model):
    """ReversedPayments model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    tid = models.CharField(max_length=200)
    account = models.CharField(max_length=200)
    balance = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    customer = models.CharField(max_length=200)
    loan = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    pay_date = models.DateTimeField(auto_now_add=True)
    amount_to_pay = models.DecimalField(max_digits=16, decimal_places=2, default=0.00)
    remarks = models.TextField()
    payment_method = models.CharField(max_length=50, null=True, blank=True)
    reference = models.CharField(max_length=50, null=True, blank=True)
    tx_id = models.CharField(max_length=50, null=True, blank=True)
    gl_code = models.CharField(max_length=50, null=True, blank=True)
    status = models.CharField(max_length=50, null=True, blank=True, default='C')

    class Meta:
        db_table = 'reversed_payments'
        verbose_name = 'ReversedPayments'
        verbose_name_plural = 'ReversedPaymentss'

    def __str__(self):
        return f'ReversedPayments #{self.id}'


class SaccosMembers(models.Model):
    """SaccosMembers model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    firstname = models.CharField(max_length=50, null=True, blank=True)
    middlename = models.CharField(max_length=50, null=True, blank=True)
    surname = models.CharField(max_length=50, null=True, blank=True)
    othername1 = models.CharField(max_length=50, null=True, blank=True)
    othername2 = models.CharField(max_length=50, null=True, blank=True)
    member_status = models.CharField(max_length=50, null=True, blank=True)
    lastmodified = models.CharField(max_length=50, null=True, blank=True)
    address = models.CharField(max_length=200, null=True, blank=True)
    dateofbirt = models.CharField(max_length=50, null=True, blank=True)
    email = models.CharField(max_length=50, null=True, blank=True)
    gender = models.CharField(max_length=50, null=True, blank=True)
    home_phone = models.CharField(max_length=50, null=True, blank=True)
    id_number = models.CharField(max_length=50, null=True, blank=True, db_column='idNumber')
    postal_address = models.CharField(max_length=50, null=True, blank=True, db_column='postalAddress')
    physical_address = models.CharField(max_length=50, null=True, blank=True, db_column='physicalAddress')
    mobilenumber = models.IntegerField(null=True, blank=True)

    class Meta:
        db_table = 'saccos_members'
        verbose_name = 'SaccosMembers'
        verbose_name_plural = 'SaccosMemberss'

    def __str__(self):
        return f'SaccosMembers #{self.id}'


class SasaPayIPN(models.Model):
    """SasaPayIPN model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    mpesaref = models.CharField(max_length=100)
    paidby = models.CharField(max_length=200)
    amountpaid = models.DecimalField(max_digits=20, decimal_places=6, default=0.000000)
    paidon = models.DateField()
    billref = models.CharField(max_length=50, default=0)

    class Meta:
        db_table = 'sasapayipn'
        verbose_name = 'SasaPayIPN'
        verbose_name_plural = 'SasaPayIPNs'

    def __str__(self):
        return f'SasaPayIPN #{self.id}'


class SMS(models.Model):
    """SMS model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    sms_gateway = models.TextField()
    username = models.TextField()
    password = models.TextField()
    api = models.TextField()
    status = models.TextField()

    class Meta:
        db_table = 'sms'
        verbose_name = 'SMS'
        verbose_name_plural = 'SMSs'

    def __str__(self):
        return f'SMS #{self.id}'


class SMSMessages(models.Model):
    """SMSMessages model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    phone = models.IntegerField(null=True, blank=True)
    message = models.CharField(null=True, blank=True)
    datetime = models.DateTimeField(null=True, blank=True)
    response = models.CharField(max_length=50, null=True, blank=True)
    url = models.CharField(null=True, blank=True)
    loan = models.IntegerField()

    class Meta:
        db_table = 'sms_messages'
        verbose_name = 'SMSMessages'
        verbose_name_plural = 'SMSMessagess'

    def __str__(self):
        return f'SMSMessages #{self.id}'


class STKPushResults(models.Model):
    """STKPushResults model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    merchant_loan_ref = models.CharField(max_length=50, default=0, db_column='MerchantLoanRef')
    sasa_pay_ref = models.CharField(max_length=20, db_column='SasaPayRef')
    result_code = models.IntegerField(default=0, db_column='ResultCode')
    result_desc = models.TextField(, db_column='ResultDesc')
    trans_amount = models.DecimalField(max_digits=12, decimal_places=2, db_column='TransAmount')
    transaction_date = models.DateField(, db_column='TransactionDate')

    class Meta:
        db_table = 'stkpushresults'
        verbose_name = 'STKPushResults'
        verbose_name_plural = 'STKPushResultss'

    def __str__(self):
        return f'STKPushResults #{self.id}'


class SystemTransactions(models.Model):
    """SystemTransactions model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    date = models.DateTimeField(null=True, blank=True)
    account = models.BigIntegerField(null=True, blank=True)
    transaction = models.CharField(max_length=50, null=True, blank=True)
    opening_balance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    debit = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    credit = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    balance = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    agent = models.CharField(max_length=50, null=True, blank=True)
    loan = models.IntegerField()
    tx_id = models.CharField(max_length=20)

    class Meta:
        db_table = 'system_transactions'
        verbose_name = 'SystemTransactions'
        verbose_name_plural = 'SystemTransactionss'

    def __str__(self):
        return f'SystemTransactions #{self.id}'


class Systemset(models.Model):
    """Systemset model for Grazuri schema compatibility"""
    sysid = models.AutoField(primary_key=True)
    title = models.CharField(max_length=200)
    name = models.CharField(max_length=200)
    footer = models.TextField()
    abb = models.CharField(max_length=200)
    fax = models.TextField()
    currency = models.TextField()
    website = models.TextField()
    mobile = models.TextField()
    image = models.CharField(max_length=200)
    modal_image = models.CharField(max_length=200)
    address = models.TextField()
    email = models.TextField()
    map = models.TextField()
    stamp = models.CharField(max_length=350)
    timezone = models.TextField()
    sms_charges = models.CharField(max_length=200)
    trading_name = models.CharField(max_length=50, null=True, blank=True)
    srn = models.CharField(max_length=50, null=True, blank=True)
    recipient = models.CharField(max_length=50, null=True, blank=True)
    submission_cycle = models.CharField(max_length=50, null=True, blank=True)
    day_of_submission = models.IntegerField(null=True, blank=True)
    sftp_url = models.CharField(max_length=100, null=True, blank=True)
    sftp_port = models.IntegerField(null=True, blank=True)
    bureau_email = models.CharField(max_length=50, null=True, blank=True)
    submission_method = models.CharField(max_length=50, null=True, blank=True)
    bureau_submission = models.IntegerField(null=True, blank=True)
    scoring = models.IntegerField(null=True, blank=True)
    file_type = models.CharField(max_length=50, null=True, blank=True)
    sftp_password = models.CharField(max_length=100, null=True, blank=True)
    sftp_username = models.CharField(max_length=50, null=True, blank=True)
    registration = models.CharField(max_length=20)

    class Meta:
        db_table = 'systemset'
        verbose_name = 'Systemset'
        verbose_name_plural = 'Systemsets'

    def __str__(self):
        return f'Systemset instance'


class TempBorrowers(models.Model):
    """TempBorrowers model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    fname = models.CharField(max_length=50, null=True, blank=True)
    lname = models.CharField(max_length=50, null=True, blank=True)
    employer = models.CharField(max_length=50, null=True, blank=True)
    salary = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    disposable = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    requestedloan = models.DecimalField(max_digits=16, decimal_places=2, null=True, blank=True)
    session = models.CharField(max_length=50, null=True, blank=True)
    agent = models.CharField(max_length=50, null=True, blank=True)
    emp_code = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'temp_borrowers'
        verbose_name = 'TempBorrowers'
        verbose_name_plural = 'TempBorrowerss'

    def __str__(self):
        return f'TempBorrowers #{self.id}'


class Transaction(models.Model):
    """Transaction model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    txid = models.CharField(max_length=200)
    t_type = models.CharField(max_length=200)
    acctno = models.CharField(max_length=200)
    fn = models.CharField(max_length=200)
    ln = models.CharField(max_length=200)
    email = models.CharField(max_length=300)
    phone = models.CharField(max_length=200)
    amount = models.CharField(max_length=200)
    date_time = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'transaction'
        verbose_name = 'Transaction'
        verbose_name_plural = 'Transactions'

    def __str__(self):
        return f'Transaction #{self.id}'


class Twallet(models.Model):
    """Twallet model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    tid = models.CharField(max_length=200)
    total = models.CharField(max_length=200, db_column='Total')

    class Meta:
        db_table = 'twallet'
        verbose_name = 'Twallet'
        verbose_name_plural = 'Twallets'

    def __str__(self):
        return f'Twallet #{self.id}'


class UnknownPayments(models.Model):
    """UnknownPayments model for Grazuri schema compatibility"""
    id = models.AutoField(primary_key=True)
    paidamt = models.DecimalField(max_digits=14, decimal_places=2, default=0.00)
    paidby = models.CharField(max_length=230)
    paidon = models.DateField()
    msisdn = models.CharField(max_length=100)
    reference = models.CharField(max_length=50, default='')
    notes = models.CharField(max_length=1020, default='')
    posted = models.IntegerField(default=0)

    class Meta:
        db_table = 'unknown_payments'
        verbose_name = 'UnknownPayments'
        verbose_name_plural = 'UnknownPaymentss'

    def __str__(self):
        return f'UnknownPayments #{self.id}'


class GrazuriUser(models.Model):
    """GrazuriUser model for Grazuri schema compatibility"""
    userid = models.AutoField(primary_key=True)
    name = models.CharField(max_length=200)
    email = models.CharField(max_length=200)
    gender = models.CharField(max_length=20)
    id_number = models.IntegerField()
    phone = models.CharField(max_length=200)
    addr1 = models.TextField()
    addr2 = models.TextField()
    district = models.CharField(max_length=200)
    country = models.CharField(max_length=200)
    comment = models.CharField(max_length=200)
    username = models.CharField(max_length=200)
    password = models.CharField(max_length=200)
    id = models.CharField(max_length=200)
    image = models.TextField(null=True, blank=True)
    role = models.CharField(max_length=200)
    date_of_birth = models.DateField(null=True, blank=True)
    passport = models.CharField(max_length=50, null=True, blank=True)
    branch = models.CharField(max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'user'
        verbose_name = 'GrazuriUser'
        verbose_name_plural = 'GrazuriUsers'

    def __str__(self):
        return f'GrazuriUser #{self.id}'
