from rest_framework import serializers


class SoilMoistureHeatmapRequestSerializer(serializers.Serializer):
    farm_uuid = serializers.UUIDField(required=True, help_text="شناسه یکتای مزرعه")


class SoilMoistureHeatmapResponseSerializer(serializers.Serializer):
    farm_uuid = serializers.CharField()
    location = serializers.JSONField()
    current_sensor = serializers.JSONField()
    soil_profile = serializers.JSONField()
    timestamp = serializers.CharField(allow_null=True)
    grid_resolution = serializers.JSONField(allow_null=True)
    grid_cells = serializers.JSONField()
    sensor_points = serializers.JSONField()
    quality_legend = serializers.JSONField()


class SoilAnomalyDetectionRequestSerializer(serializers.Serializer):
    farm_uuid = serializers.UUIDField(required=True, help_text="شناسه یکتای مزرعه")


class SoilHealthSummaryRequestSerializer(serializers.Serializer):
    farm_uuid = serializers.UUIDField(required=True, help_text="شناسه یکتای مزرعه")


class SoilHealthSummaryResponseSerializer(serializers.Serializer):
    farm_uuid = serializers.CharField()
    healthScore = serializers.IntegerField()
    profileSource = serializers.CharField()
    healthScoreDetails = serializers.JSONField()
    healthLanguage = serializers.JSONField()
    avgSoilMoisture = serializers.IntegerField()
    avgSoilMoistureRaw = serializers.FloatField()
    avgSoilMoistureStatus = serializers.CharField()


class SoilAnomalyDetectionResponseSerializer(serializers.Serializer):
    farm_uuid = serializers.CharField()
    generated_at = serializers.CharField()
    anomalies = serializers.JSONField()
    interpretation = serializers.JSONField()
    raw_response = serializers.CharField(allow_null=True, required=False)
