from rest_framework import serializers

from .models import Caliber


class CaliberSerializer(serializers.ModelSerializer):
    class Meta:
        model = Caliber
        fields = [
            'id', 'name', 'short_name',
            'case_length_mm', 'overall_length_mm', 'bullet_diameter_mm',
            'case_head_diameter_mm', 'rim_diameter_mm', 'max_pressure_mpa',
            'notes',
            'status', 'submitted_by', 'reviewed_by', 'reviewed_at',
            'created_at', 'updated_at',
        ]
        read_only_fields = ['status', 'submitted_by', 'reviewed_by', 'reviewed_at', 'created_at', 'updated_at']


class CaliberListSerializer(serializers.ModelSerializer):
    class Meta:
        model = Caliber
        fields = ['id', 'name', 'short_name', 'status', 'max_pressure_mpa']
