from django.db import models
from accounts.models import Enterprise 
from hub.models import Channel

# Create your models here.

# generic model
# pre-populated  
class SwitchModel(models.Model):
    name  = models.CharField(max_length=200)
    desc = models.TextField(null=True, blank=True)

    def __str__(self):
        return '%s' % self.name

class TelSwitch(models.Model):
    name  = models.CharField(max_length=100)
    domain = models.CharField(max_length=100, null=True, blank=True)
    address = models.CharField(max_length=100, null=True, blank=True)
    make = models.ForeignKey(SwitchModel, related_name="tel_exchanges")
 
    # multi tenancy
    account = models.ForeignKey(Enterprise, related_name="tel_exchanges")

    def __str__(self):
        return '%s' % self.name

class TelProfile(models.Model):
    extn  = models.CharField(max_length=20)
    user  = models.CharField(max_length=100, null=True, blank=True)
    pswd  = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name="tel_profiles")
    # Voice Mail infomation

    # multi tenancy
    account = models.ForeignKey(Enterprise, related_name="tel_profiles")

    def __str__(self):
        return '%s' % self.extn

class ConfProfile(models.Model):
    bridge_id =  models.CharField(max_length=20)
    password = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name="conf_profiles") 
   
    
    def __str__(self):
        return '%s' % self.bridge_id
 

"""
Contact - Synchronized for multiple sources
"""
class Contact(models.Model):
    first_name = models.CharField(max_length=100, null=True, blank=True)
    last_name = models.CharField(max_length=100, null=True, blank=True)
    mobile = models.CharField(max_length=20, null=True, blank=True)
    work = models.CharField(max_length=20, null=True, blank=True)
    title = models.CharField(max_length=100, null=True, blank=True)
    company = models.CharField(max_length=100, null=True, blank=True)
    email = models.CharField(max_length=100, null=True, blank=True)
    photo = models.ImageField(upload_to='photo', null=True, blank=True)

    # external source
    channel = models.ForeignKey(Channel, null=True, blank=True, related_name="contacts")
    source_id =  models.CharField(max_length=200, null=True, blank=True)
    source_module = models.CharField(max_length=100, null=True, blank=True)
    
    
    def __str__(self):
        return '%s' % self.first_name

    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name)

879af97178700d19c3f278d10772c44b7aa34acc
<mask token>


class ConfProfile(models.Model):
    bridge_id = models.CharField(max_length=20)
    password = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name='conf_profiles')

    def __str__(self):
        return '%s' % self.bridge_id


<mask token>


class Contact(models.Model):
    first_name = models.CharField(max_length=100, null=True, blank=True)
    last_name = models.CharField(max_length=100, null=True, blank=True)
    mobile = models.CharField(max_length=20, null=True, blank=True)
    work = models.CharField(max_length=20, null=True, blank=True)
    title = models.CharField(max_length=100, null=True, blank=True)
    company = models.CharField(max_length=100, null=True, blank=True)
    email = models.CharField(max_length=100, null=True, blank=True)
    photo = models.ImageField(upload_to='photo', null=True, blank=True)
    channel = models.ForeignKey(Channel, null=True, blank=True,
        related_name='contacts')
    source_id = models.CharField(max_length=200, null=True, blank=True)
    source_module = models.CharField(max_length=100, null=True, blank=True)

    def __str__(self):
        return '%s' % self.first_name

    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name)

<mask token>


class TelProfile(models.Model):
    extn = models.CharField(max_length=20)
    user = models.CharField(max_length=100, null=True, blank=True)
    pswd = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name='tel_profiles')
    account = models.ForeignKey(Enterprise, related_name='tel_profiles')

    def __str__(self):
        return '%s' % self.extn


class ConfProfile(models.Model):
    bridge_id = models.CharField(max_length=20)
    password = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name='conf_profiles')

    def __str__(self):
        return '%s' % self.bridge_id


<mask token>


class Contact(models.Model):
    first_name = models.CharField(max_length=100, null=True, blank=True)
    last_name = models.CharField(max_length=100, null=True, blank=True)
    mobile = models.CharField(max_length=20, null=True, blank=True)
    work = models.CharField(max_length=20, null=True, blank=True)
    title = models.CharField(max_length=100, null=True, blank=True)
    company = models.CharField(max_length=100, null=True, blank=True)
    email = models.CharField(max_length=100, null=True, blank=True)
    photo = models.ImageField(upload_to='photo', null=True, blank=True)
    channel = models.ForeignKey(Channel, null=True, blank=True,
        related_name='contacts')
    source_id = models.CharField(max_length=200, null=True, blank=True)
    source_module = models.CharField(max_length=100, null=True, blank=True)

    def __str__(self):
        return '%s' % self.first_name

    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name)

<mask token>


class SwitchModel(models.Model):
    name = models.CharField(max_length=200)
    desc = models.TextField(null=True, blank=True)

    def __str__(self):
        return '%s' % self.name


class TelSwitch(models.Model):
    name = models.CharField(max_length=100)
    domain = models.CharField(max_length=100, null=True, blank=True)
    address = models.CharField(max_length=100, null=True, blank=True)
    make = models.ForeignKey(SwitchModel, related_name='tel_exchanges')
    account = models.ForeignKey(Enterprise, related_name='tel_exchanges')

    def __str__(self):
        return '%s' % self.name


class TelProfile(models.Model):
    extn = models.CharField(max_length=20)
    user = models.CharField(max_length=100, null=True, blank=True)
    pswd = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name='tel_profiles')
    account = models.ForeignKey(Enterprise, related_name='tel_profiles')

    def __str__(self):
        return '%s' % self.extn


class ConfProfile(models.Model):
    bridge_id = models.CharField(max_length=20)
    password = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name='conf_profiles')

    def __str__(self):
        return '%s' % self.bridge_id


<mask token>


class Contact(models.Model):
    first_name = models.CharField(max_length=100, null=True, blank=True)
    last_name = models.CharField(max_length=100, null=True, blank=True)
    mobile = models.CharField(max_length=20, null=True, blank=True)
    work = models.CharField(max_length=20, null=True, blank=True)
    title = models.CharField(max_length=100, null=True, blank=True)
    company = models.CharField(max_length=100, null=True, blank=True)
    email = models.CharField(max_length=100, null=True, blank=True)
    photo = models.ImageField(upload_to='photo', null=True, blank=True)
    channel = models.ForeignKey(Channel, null=True, blank=True,
        related_name='contacts')
    source_id = models.CharField(max_length=200, null=True, blank=True)
    source_module = models.CharField(max_length=100, null=True, blank=True)

    def __str__(self):
        return '%s' % self.first_name

    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name)

from django.db import models
from accounts.models import Enterprise
from hub.models import Channel


class SwitchModel(models.Model):
    name = models.CharField(max_length=200)
    desc = models.TextField(null=True, blank=True)

    def __str__(self):
        return '%s' % self.name


class TelSwitch(models.Model):
    name = models.CharField(max_length=100)
    domain = models.CharField(max_length=100, null=True, blank=True)
    address = models.CharField(max_length=100, null=True, blank=True)
    make = models.ForeignKey(SwitchModel, related_name='tel_exchanges')
    account = models.ForeignKey(Enterprise, related_name='tel_exchanges')

    def __str__(self):
        return '%s' % self.name


class TelProfile(models.Model):
    extn = models.CharField(max_length=20)
    user = models.CharField(max_length=100, null=True, blank=True)
    pswd = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name='tel_profiles')
    account = models.ForeignKey(Enterprise, related_name='tel_profiles')

    def __str__(self):
        return '%s' % self.extn


class ConfProfile(models.Model):
    bridge_id = models.CharField(max_length=20)
    password = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name='conf_profiles')

    def __str__(self):
        return '%s' % self.bridge_id


<mask token>


class Contact(models.Model):
    first_name = models.CharField(max_length=100, null=True, blank=True)
    last_name = models.CharField(max_length=100, null=True, blank=True)
    mobile = models.CharField(max_length=20, null=True, blank=True)
    work = models.CharField(max_length=20, null=True, blank=True)
    title = models.CharField(max_length=100, null=True, blank=True)
    company = models.CharField(max_length=100, null=True, blank=True)
    email = models.CharField(max_length=100, null=True, blank=True)
    photo = models.ImageField(upload_to='photo', null=True, blank=True)
    channel = models.ForeignKey(Channel, null=True, blank=True,
        related_name='contacts')
    source_id = models.CharField(max_length=200, null=True, blank=True)
    source_module = models.CharField(max_length=100, null=True, blank=True)

    def __str__(self):
        return '%s' % self.first_name

    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name)

from django.db import models
from accounts.models import Enterprise 
from hub.models import Channel

# Create your models here.

# generic model
# pre-populated  
class SwitchModel(models.Model):
    name  = models.CharField(max_length=200)
    desc = models.TextField(null=True, blank=True)

    def __str__(self):
        return '%s' % self.name

class TelSwitch(models.Model):
    name  = models.CharField(max_length=100)
    domain = models.CharField(max_length=100, null=True, blank=True)
    address = models.CharField(max_length=100, null=True, blank=True)
    make = models.ForeignKey(SwitchModel, related_name="tel_exchanges")
 
    # multi tenancy
    account = models.ForeignKey(Enterprise, related_name="tel_exchanges")

    def __str__(self):
        return '%s' % self.name

class TelProfile(models.Model):
    extn  = models.CharField(max_length=20)
    user  = models.CharField(max_length=100, null=True, blank=True)
    pswd  = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name="tel_profiles")
    # Voice Mail infomation

    # multi tenancy
    account = models.ForeignKey(Enterprise, related_name="tel_profiles")

    def __str__(self):
        return '%s' % self.extn

class ConfProfile(models.Model):
    bridge_id =  models.CharField(max_length=20)
    password = models.CharField(max_length=100, null=True, blank=True)
    switch = models.ForeignKey(TelSwitch, related_name="conf_profiles") 
   
    
    def __str__(self):
        return '%s' % self.bridge_id
 

"""
Contact - Synchronized for multiple sources
"""
class Contact(models.Model):
    first_name = models.CharField(max_length=100, null=True, blank=True)
    last_name = models.CharField(max_length=100, null=True, blank=True)
    mobile = models.CharField(max_length=20, null=True, blank=True)
    work = models.CharField(max_length=20, null=True, blank=True)
    title = models.CharField(max_length=100, null=True, blank=True)
    company = models.CharField(max_length=100, null=True, blank=True)
    email = models.CharField(max_length=100, null=True, blank=True)
    photo = models.ImageField(upload_to='photo', null=True, blank=True)

    # external source
    channel = models.ForeignKey(Channel, null=True, blank=True, related_name="contacts")
    source_id =  models.CharField(max_length=200, null=True, blank=True)
    source_module = models.CharField(max_length=100, null=True, blank=True)
    
    
    def __str__(self):
        return '%s' % self.first_name

    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name)
