from rest_framework import serializers

from .models import Contract, Customer


class CustomerSerializer(serializers.ModelSerializer):
    class Meta:
        model = Customer
        fields = '__all__'

class CustomerCreateUpdateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Customer
        fields = ['name', 'address', 'contact', 'contact_phone', 'description']

class CustomerSimpleSerializer(serializers.ModelSerializer):
    class Meta:
        fields = ['id', 'name']

class ContractSerializer(serializers.ModelSerializer):

    class Meta:
        model = Contract
        fields = '__all__'

class ContractCreateUpdateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Contract
        fields = ['name', 'number', 'amount', 'customer', 'sign_date', 'description']