from django.db import models
from multiselectfield import MultiSelectField

# ATTENTION!!!
# No key should be used twice in any of these dicts because of the
# suboptimal implementation in views.EvaFormView.beautify_data()
#

DEPARTMENT_CHOICES = {'PROG': 'Programme',
                      'SOFT': 'Softwareentwicklung',
                      'CENT': 'Central',
                      'VOR': 'Vorstand',}

LAPTOP_CHOICES = {'14': '14", Unser Standardgerät',
                  '12': '12,5", Geeignet für Vielreisende',}

VENDOR_CHOICES = {'STANDARD': 'Dell Latitude',
                 'LENOVO': 'Lenovo Thinkpad',
                 'MAC': 'Mac (nur in Ausnahmefällen)'}

OS_CHOICES = {'UBU': 'Ubuntu (Standard)',
              'WIN': 'Windows (bitte Begründung angeben)',}

MOBILE_CHOICES = {'NO': 'Kein Mobiltelefon',
                  'SIMPLE': 'Einfaches Gerät für Erreichbarkeit',
                  'SINGLE': 'Smartphone, Single SIM',
                  'DUAL': 'Smartphone, Dual SIM',}

LANG_CHOICES = {'GER': 'Deutsch',
                'ENG': 'English',}

ACCOUNT_CHOICES = {'OTRSWMDE': 'OTRS Ticketsystem',
                   'CIVIC1': 'Civic CRM (allgemein)',
                   'CIVIC2': "Civic CRM (Mailings, impliziert allgemein)",
                   'ZEDA': "Zeda Nextcloud",
                   'WEB': 'www.wikimedia.de (edit)',
                   'BLOG': 'blog.wikimedia.de (edit)',
                   'FORUM': 'forum.wikimedia.de',
                   }

TRANSPONDER_CHOICES = {'NORM': 'Allgemeiner Transponder',
                       'SPECIAL': 'Besondere Schließungen (bitte angeben)',
                       'NOTRANS': 'Kein Transponder',}

class Employee(models.Model):
    # personal data
    firstname = models.CharField(max_length=50, verbose_name="Vorname")
    lastname = models.CharField(max_length=50, verbose_name="Nachname")
    intern = models.BooleanField(verbose_name='Interne_r Mitarbeiter_in?', default=True)
    email = models.EmailField(max_length=50, verbose_name="E-Mail-Adresse")
    department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items())
    team = models.CharField(max_length=20, null=True, blank=True) # TODO? besser als choices?

    # general work related stuff
    firstdate_employment = models.DateField(null=True, verbose_name="Erster Arbeitstag")
    firstdate_presence = models.DateField(null=True, verbose_name="Erster Tag der Anwesenheit in der Geschäftsstelle")
    jobdescription_german = models.CharField(null=True, max_length=100, verbose_name="Stellenbeschreibung(deutsch)")
    jobdescription_english = models.CharField(null=True, max_length=100, verbose_name="Job description(english)")
    remote = models.BooleanField(verbose_name='Braucht keinen Arbeitsplatz weil Home-Office', default=False)
    desk = models.CharField(max_length=100, null=True, blank=True, verbose_name="Wo soll der Arbeitsplatz sein?")

    # IT related stuff
    laptop = models.CharField(max_length=2, choices=LAPTOP_CHOICES.items(), default='14')
    vendor = models.CharField(max_length=8, choices=VENDOR_CHOICES.items(), default='STANDARD')
    os = models.CharField(max_length=3, choices=OS_CHOICES.items(), default='UBU')
    screen = models.BooleanField(default=False, verbose_name='Zusätzlicher Monitor? Einer ist standard.')
    mobile = models.CharField(max_length=6, default='NO')
    landline = models.BooleanField(default=True, verbose_name="Festnetztelefon")
    comment = models.TextField(max_length=500, null=True, blank=True, verbose_name="zusätzliche IT-Anforderungen")
    language = models.CharField(max_length=3, choices=LANG_CHOICES.items(), default="GER")
    accounts = MultiSelectField(choices=ACCOUNT_CHOICES.items(), null=True)
    lists = models.CharField(max_length=100, null=True)
    rebu2go = models.BooleanField(verbose_name="Rebu2Go-Zugang benötigt?", default=False)

    # office related stuff
    transponder = models.CharField(max_length=7, choices=TRANSPONDER_CHOICES.items(), default='NORM')
    special = models.TextField(max_length=500, null=True, blank=True, verbose_name="Besondere Schließungen hier eintragen")
    post_office_box = models.BooleanField(default=True, verbose_name='Postfach am Empfang benötigt?')