import logging

from django.core.exceptions import ValidationError
from django.db import models

from django.utils.translation import gettext_lazy as _
from model_utils.models import TimeStampedModel, TimeFramedModel


logger = logging.getLogger(__name__)


class TimeRecord(TimeStampedModel):
    """
    TimeRecord database model holding the time records from the timer.
    """
    timer_id = models.CharField(max_length=20, null=True, blank=True, verbose_name=_('Timer identifier'))
    chip_id = models.CharField(max_length=100, null=True, blank=True, verbose_name=_('Chip identifier'))
    time = models.DateTimeField(verbose_name=_('Time'))

    class Meta:
        verbose_name = _('Time Record')
        verbose_name_plural = _('Time Records')

    def __str__(self):
        return f'{self.timer_id} - {self.chip_id}'
