from django.db import models

# Create your models here.
from utenti.models import *

class Liste(models.Model):
  id = models.IntegerField(db_column='id',primary_key=True)
  dominio = models.ForeignKey('domini.Domini',db_column='dominio',on_delete=models.CASCADE)
  nome = models.CharField(db_column='nome',max_length=64)
  tobedeleted = models.BooleanField(db_column='tobedeleted',default=0)
  enabled = models.BooleanField(db_column='enabled',default=1)
  addinprogress = models.BooleanField(db_column='addinprogress',default=0)
  delinprogress = models.BooleanField(db_column='delinprogress',default=0)
  disinprogress = models.BooleanField(db_column='disinprogress',default=0)
  enainprogress = models.BooleanField(db_column='enainprogress',default=0)
  postmaster = models.CharField(db_column='postmaster',max_length=64)
  class Meta:
    ordering = ['nome']
    db_table = 'mailinglist'
    managed = False

class ListeAccount(models.Model):
  id = models.IntegerField(db_column='id',primary_key=True)
  liste = models.ForeignKey('Liste', db_column='liste', on_delete=models.CASCADE)
  mail = models.ForeignKey('utenti.User',db_column='mail',on_delete=models.CASCADE)
  esterno = models.CharField(db_column='esterno',max_length=256)
  enabled = models.BooleanField(db_column='enabled',default=1)
  tobedeleted = models.BooleanField(db_column='tobedeleted',default=0)
  addinprogress = models.BooleanField(db_column='addinprogress',default=0)
  delinprogress = models.BooleanField(db_column='delinprogress',default=0)
  disinprogress = models.BooleanField(db_column='disinprogress',default=0)
  enainprogress = models.BooleanField(db_column='enainprogress',default=0)
  verificato = models.BooleanField(db_column='verificato',default=True)
  class Meta:
    ordering = ['liste']
    db_table = 'mailinglist_account'
    managed  = False

class ListeAdmin(models.Model):
  id = models.IntegerField(db_column='id',primary_key=True)
  liste = models.ForeignKey('Liste', db_column='liste', on_delete=models.CASCADE)
  mail = models.ForeignKey('utenti.User',db_column='mail',on_delete=models.CASCADE)
  esterno = models.CharField(db_column='esterno',max_length=256)
  enabled = models.BooleanField(db_column='enabled',default=1)
  tobedeleted = models.BooleanField(db_column='tobedeleted',default=0)
  addinprogress = models.BooleanField(db_column='addinprogress',default=0)
  delinprogress = models.BooleanField(db_column='delinprogress',default=0)
  disinprogress = models.BooleanField(db_column='disinprogress',default=0)
  enainprogress = models.BooleanField(db_column='enainprogress',default=0)
  verificato = models.BooleanField(db_column='verificato',default=True)
  class Meta:
    ordering = ['liste']
    db_table = 'mailinglist_admin'
    managed  = False

