import logging

from rest_framework import serializers

from assets.models.assets import Asset, AssetManufacturer
from console.models import Vulnerability
from incident.models import Incident

_log = logging.getLogger(__name__)


class IncidentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Incident
        fields = ["title", "category", "importance", "assigned_to", "event_count", "description", "comment",
                  "close_recommendations", "effects", "events", "sensor"]


class AssetSerializer(serializers.ModelSerializer):
    class Meta:
        model = Asset
        fields = ["name", "description", "manufacturer", "model", "ip", "os", "ports", "vulnerabilities", "group",
                  "asset_type", "status", "sensor"]


class AssetCorrelationSerializer(serializers.ModelSerializer):
    class Meta:
        model = Asset
        fields = ["asset_type", "description", "group", "ip", "manufacturer", "model", "name", "os", "ports", "sensor"]


class ManufacturerSerializer(serializers.ModelSerializer):
    class Meta:
        model = AssetManufacturer
        fields = ["id", "name", "description"]


class VulnerabilitiesSerializer(serializers.ModelSerializer):
    class Meta:
        model = Vulnerability
        fields = ["id", "name", "description"]
