from django.db import models
from model_utils import Choices

# Create your models here.


class carrera(models.Model):
    nombre = models.CharField(max_length=200, null=False, unique=True, verbose_name='Nombre')
    def __str__(self):
        return self.nombre
    
    class Meta:
        verbose_name = 'carrera'
        verbose_name_plural = 'carreras'
        ordering = ['nombre']


class asignatura(models.Model):
    CUATRI = Choices('0','1','2','3','4','5','6','7','8','9','10')
    nombre = models.CharField(max_length=200, null=False, unique=True, verbose_name='Nombre')
    cuatri = models.CharField(choices=CUATRI, default=0, max_length=2, verbose_name='Cuatrimestre')
    creditos = models.IntegerField(verbose_name='Creditos')
    id_carrera = models.ForeignKey(carrera, on_delete=models.CASCADE, null=False, blank=False, verbose_name='ID Carrera')
    def __str__(self):
        return self.nombre
    
    class Meta:
        verbose_name = 'asignatura'
        verbose_name_plural = 'asignaturas'
        ordering = ['nombre']


class area(models.Model):
    nombre = models.CharField(max_length=200, null=False, unique=True, verbose_name='Nombre')
    descripcion = models.TextField(blank=True, null=True, verbose_name='Descripcion')
    def __str__(self):
        return self.nombre
    
    class Meta:
        verbose_name = 'area'
        verbose_name_plural = 'areas'
        ordering = ['nombre']


class material(models.Model):
    nombre = models.CharField(max_length=200, null=False, unique=True, verbose_name='Nombre')
    descripcion = models.TextField(blank=True, null=True, verbose_name='Descripcion')
    def __str__(self):
        return self.nombre
    
    class Meta:
        verbose_name = 'material'
        verbose_name_plural = 'materiales'
        ordering = ['nombre']


class laboratorio(models.Model):
    nombre = models.CharField(max_length=200, null=False, unique=True, verbose_name='Nombre')
    descripcion = models.TextField(blank=True, null=True, verbose_name='Descripcion')
    def __str__(self):
        return self.nombre
    
    class Meta:
        verbose_name = 'laboratorio'
        verbose_name_plural = 'laboratorios'
        ordering = ['nombre']


