from bulk_update_or_create import BulkUpdateOrCreateQuerySet
from django.db import models

from .administre import Administre, Administres_Pams


class FMOB(models.Model):
    """Modèle de FMOB
    """
    CHOICES_STATUT = [('Annulé', 'Annulé'), ('Classé sans suite', 'Classé sans suite'), ('Non réceptionné', 'Non réceptionné'),
                      ('Réceptionné', 'Réceptionné')]
    objects = BulkUpdateOrCreateQuerySet.as_manager()

    fmob_id = models.CharField(max_length=100, primary_key=True)
    administre = models.OneToOneField(Administres_Pams, on_delete=models.CASCADE, null=True, blank=True, related_name='fmobs')
    #administre = models.ForeignKey(Administre, on_delete=models.CASCADE, null=True, blank=True, related_name=Administre.Cols.O2M_FMOB, db_constraint=False)
    fmob_millesime = models.IntegerField(null=True, blank=True)
    fmob_millesime_femp =  models.IntegerField(null=True, blank=True)
    fmob_reception_drhat_fmob = models.BooleanField(default=False)
    fmob_annulation_fmob = models.BooleanField(default=False)
    fmob_annulation_femp = models.BooleanField(default=False)
    fmob_sans_suite_militaire_fmob = models.BooleanField(default=False)
    fmob_sans_suite_militaire_femp = models.BooleanField(default=False)
    fmob_date_visa_militaire = models.DateField(max_length=100, null=True, blank=True)
    fmob_depart_institution_soff = models.BooleanField(default=False)
    fmob_mobilite_bassin_externe = models.BooleanField(default=False)
    fmob_mobilite_bassin_interne = models.BooleanField(default=False)
    fmob_mobilite_centre_interet_adt = models.BooleanField(default=False)
    fmob_mobilite_dans_specialite = models.BooleanField(default=False)
    fmob_mobilite_hors_metropole = models.BooleanField(default=False)
    fmob_mobilite_recrutement_particulier_administre = models.BooleanField(default=False)
    fmob_motif_edition_la = models.CharField(max_length=100, null=True, blank=True)
    fmob_motif_edition_ll = models.CharField(max_length=100, null=True, blank=True)
    fmob_reception_drhat_fmob = models.BooleanField(default=False)
    fmob_reconnaissance_parcours_pro_administre = models.BooleanField(default=False)
    fmob_proposition_affectation_verrouille = models.CharField(max_length=100, null=True, blank=True)
    fmob_reception_drhat_femp = models.BooleanField(default=False)
    fmob_avis_cdc_mobilite_interne = models.BooleanField(default=False)
    fmob_avis_cdc_mobilite_externe = models.BooleanField(default=False)
    fmob_avis_cdc_mutation_administre = models.BooleanField(default=False)
    fmob_avis_cdc_mobilite_centre_interet = models.BooleanField(default=False)
    fmob_avis_cdc_mobilite_specialite = models.BooleanField(default=False)
    fmob_avis_cdc_mobilite_hors_metropole = models.BooleanField(default=False)
    fmob_avis_cdc_mobilite_recrutement_particulier_admin = models.BooleanField(default=False)
    fmob_date_deb_fmob = models.CharField(max_length=100, null=True, blank=True)
    fmob_date_fin_fmob = models.CharField(max_length=100, null=True, blank=True)
    fmob_date_signature_admin_fmob = models.DateField(max_length=100, null=True, blank=True)
    fmob_date_signature_admin_femp = models.DateField(max_length=100, null=True, blank=True)
    fmob_date_signature_chef_de_corps = models.DateField(max_length=100, null=True, blank=True)
    fmob_remarques_eventuelles_administres = models.TextField(null=True, blank=True)
    fmob_avis_commandant_formation = models.TextField(null=True, blank=True)
    fmob_fonction_1 = models.CharField(max_length=100, null=True, blank=True)
    fmob_fonction_2 = models.CharField(max_length=100, null=True, blank=True)
    fmob_fonction_3 = models.CharField(max_length=100, null=True, blank=True)
    fmob_fonction_4 = models.CharField(max_length=100, null=True, blank=True)
    fmob_fonction_5 = models.CharField(max_length=100, null=True, blank=True)
    fmob_commune_1 = models.CharField(max_length=100, null=True, blank=True)
    fmob_commune_2 = models.CharField(max_length=100, null=True, blank=True)
    fmob_commune_3 = models.CharField(max_length=100, null=True, blank=True)
    fmob_commune_4 = models.CharField(max_length=100, null=True, blank=True)
    fmob_commune_5 = models.CharField(max_length=100, null=True, blank=True)
    fmob_prio_1 = models.BooleanField(default=False)
    fmob_prio_2 = models.BooleanField(default=False)
    fmob_prio_3 = models.BooleanField(default=False)
    fmob_prio_4 = models.BooleanField(default=False)
    fmob_prio_5 = models.BooleanField(default=False)
    fmob_avis_mutabilite = models.CharField(max_length=100, null=True, blank=True)
    fmob_obs = models.CharField(max_length=100, null=True, blank=True)
    fmob_fe_future = models.CharField(max_length=100, null=True, blank=True)
    fmob_statut = models.CharField(max_length=100, null=True, blank=True, choices=CHOICES_STATUT)
    fmob_commentaire_ac = models.TextField(null=True, blank=True)
