# Path: cyder/api/v1/endpoints/dns/api.py
# class FQDNMixin(object):
# class LabelDomainMixin(object):
# class CommonDNSSerializer(api.CommonAPISerializer):
# class CommonDNSMeta(api.CommonAPIMeta):
# class CommonDNSViewSet(api.CommonAPIViewSet):
#     def restore_object(self, attrs):


from rest_framework import serializers
from cyder.api.v1.endpoints.api import CommonAPINestedAVSerializer
from cyder.api.v1.endpoints.dns import api
from cyder.cydns.soa.models import SOA, SOAAV



class SOAAVSerializer(serializers.ModelSerializer):
    id = serializers.Field(source='id')
    entity = serializers.HyperlinkedRelatedField(
        view_name='api-dns-soa-detail')
    attribute = serializers.SlugRelatedField(slug_field='name')

    class Meta:  # don't import from api.CommonDNSMeta so we get all fields
        model = SOAAV


class SOAAVViewSet(api.CommonDNSViewSet):
    model = SOAAV
    serializer_class = SOAAVSerializer


class SOANestedKeyValueSerializer(CommonAPINestedAVSerializer):
    id = serializers.HyperlinkedIdentityField(
        view_name='api-dns-soa_attributes-detail')

    class Meta:
        model = SOAAV

# Path: cyder/api/v1/endpoints/dns/api.py
# class FQDNMixin(object):
# class LabelDomainMixin(object):
# class CommonDNSSerializer(api.CommonAPISerializer):
# class CommonDNSMeta(api.CommonAPIMeta):
# class CommonDNSViewSet(api.CommonAPIViewSet):
#     def restore_object(self, attrs):


# Path: cyder/api/v1/endpoints/dns/soa/api.py
from rest_framework import serializers
from cyder.api.v1.endpoints.api import CommonAPINestedAVSerializer
from cyder.api.v1.endpoints.dns import api
from cyder.cydns.soa.models import SOA, SOAAV




class SOAAVSerializer(serializers.ModelSerializer):
    id = serializers.Field(source='id')
    entity = serializers.HyperlinkedRelatedField(
        view_name='api-dns-soa-detail')
    attribute = serializers.SlugRelatedField(slug_field='name')

    class Meta:  # don't import from api.CommonDNSMeta so we get all fields
        model = SOAAV


class SOAAVViewSet(api.CommonDNSViewSet):
    model = SOAAV
    serializer_class = SOAAVSerializer


class SOANestedKeyValueSerializer(CommonAPINestedAVSerializer):
    id = serializers.HyperlinkedIdentityField(
        view_name='api-dns-soa_attributes-detail')

    class Meta:
        model = SOAAV

        fields = api.NestedKeyValueFields