from rest_framework import serializers

from bonus_program.models import BonusProgramTransaction


class BonusProgramTransactionSerializer(serializers.ModelSerializer):
    order_id = serializers.StringRelatedField(source='order.id', allow_null=True)
    type = serializers.CharField(source='get_type_display')

    class Meta:
        model = BonusProgramTransaction
        fields = ('id', 'type', 'date', 'amount', 'order_id', 'comment', 'was_cancelled')
