package com.agent.management.rag.structured;

import com.agent.management.rag.capability.SqlSchemaSnapshot;
import com.agent.management.service.SchemaExplorerService;

import java.time.Instant;
import java.util.List;
import java.util.Map;

public record StructuredSchemaProfile(
        Long dataSourceId,
        String dialect,
        String catalog,
        String schema,
        String sourceFingerprint,
        String schemaFingerprint,
        String algorithmVersion,
        String profileVersion,
        String scanStatus,
        Instant scannedAt,
        SqlSchemaSnapshot schemaSnapshot,
        Map<String, List<SchemaExplorerService.ColumnSpec>> columnSpecs,
        List<StructuredRelationship> relationships,
        List<String> warnings) {

    public StructuredSchemaProfile {
        catalog = catalog == null ? "" : catalog;
        schema = schema == null ? "" : schema;
        columnSpecs = Map.copyOf(columnSpecs == null ? Map.of() : columnSpecs);
        relationships = List.copyOf(relationships == null ? List.of() : relationships);
        warnings = List.copyOf(warnings == null ? List.of() : warnings);
    }
}
