from rest_framework import serializers
from .models import Order


class OrderSerializer(serializers.ModelSerializer):
	# Nested read-only representations
	# product = ProductSerializer(read_only=True)
	# carrier = CarrierSerializer(read_only=True)

	# Write-only foreign keys
	# product_id = serializers.PrimaryKeyRelatedField(
	# 	queryset=Product.objects.all(), source="product", write_only=True
	# )
	# carrier_id = serializers.PrimaryKeyRelatedField(
	# 	queryset=Carrier.objects.all(), source="carrier", write_only=True
	# )

	class Meta:
		model = Order
		fields = [
			"id",
			"amount",
			"currency",
			"status",
			"stripe_session_id",
			"stripe_payment_intent",
			"created_at",
		]
		read_only_fields = ("created_at",)
