from rest_framework import serializers

from company.models.company import Company
from company.serializers.location import LocationSerializer


class CompanySerializer(serializers.ModelSerializer):
    """Serializer for retrieve."""

    location = LocationSerializer()

    class Meta:
        model = Company
        fields = ('name', 'is_cii', 'location', 'city', 'affected_system_function', 'api_key')


class CompanyCreateSerializer(serializers.ModelSerializer):
    """Serializer for creating and updating Company."""

    class Meta:
        model = Company
        fields = ('name', 'is_cii', 'location', 'city', 'affected_system_function', 'api_key')
