"""
音乐模块序列化器
"""
from rest_framework import serializers
from .models import Track


class TrackSerializer(serializers.ModelSerializer):
    """音乐曲目序列化器"""

    class Meta:
        model = Track
        fields = ['id', 'title', 'lyrics', 'audio_url', 'cover_url',
                  'mood', 'duration', 'is_favorite', 'is_default',
                  'generation_status', 'created_at']


class GenerateMusicSerializer(serializers.Serializer):
    """生成音乐序列化器"""
    text = serializers.CharField(max_length=500, required=False, allow_blank=True, default='')
    mood = serializers.ChoiceField(
        choices=['chill', 'happy', 'sleepy', 'random', 'custom'],
        required=False,
        default='custom'
    )
