from rest_framework import serializers

from ..models import Sound

__all__ = ("SoundSerializer", "PodcastSerializer")


class SoundSerializer(serializers.ModelSerializer):
    file = serializers.FileField(use_url=False)

    class Meta:
        model = Sound
        fields = [
            "pk",
            "name",
            "program",
            "episode",
            "type",
            "file",
            "duration",
            "mtime",
            "is_good_quality",
            "is_public",
            "url",
        ]


class PodcastSerializer(serializers.ModelSerializer):
    # serializers.HyperlinkedIdentityField(view_name='sound', format='html')

    class Meta:
        model = Sound
        fields = [
            "pk",
            "name",
            "program",
            "episode",
            "type",
            "duration",
            "mtime",
            "url",
            "is_downloadable",
        ]
