from rest_framework import serializers
from .models import Vehiculo, Repostaje


class VehiculoSerializer(serializers.ModelSerializer):
    class Meta:
        model = Vehiculo
        fields = '__all__'  # Incluir todos los campos del modelo


class RepostajeSerializer(serializers.ModelSerializer):
    vehiculo_matricula = serializers.CharField(source='vehiculo.matricula', read_only=True)

    class Meta:
        model = Repostaje
        fields = ['id', 'fecha', 'kms', 'litros', 'descuento', 'importe', 'precioxlitro', 'kmsrecorridos', 'consumo', 'vehiculo', 'vehiculo_matricula']
