INSERT INTO ai.tb_ai_knowledge_file (
    file_id, file_code, file_name, file_type, file_status,
    graph_sync_status, vector_sync_status, metadata_json,
    adcode, tenant_id, tenant_path, dept_id, dept_path
) VALUES (
    'KF-DEMO-001', 'K12_DEMO_KNOWLEDGE_FILE', 'K12示例知识文件', 'DOCUMENT', 'ACTIVE',
    'PENDING', 'PENDING', '{"source":"seed","scenario":"knowledge_file_management"}'::JSONB,
    '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/'
)
ON CONFLICT (file_id) DO NOTHING;

INSERT INTO ai.tb_ai_graph_entity (
    entity_id, file_id, entity_type, entity_name, normalized_name, sync_status, properties_json,
    adcode, tenant_id, tenant_path, dept_id, dept_path
) VALUES (
    'GE-KP-001', 'KF-DEMO-001', 'KNOWLEDGE_POINT', '一次函数', '一次函数', 'PENDING',
    '{"subject":"math","grade":"7"}'::JSONB,
    '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/'
)
ON CONFLICT (entity_id) DO NOTHING;

INSERT INTO ai.tb_ai_graph_entity (
    entity_id, file_id, entity_type, entity_name, normalized_name, sync_status, properties_json,
    adcode, tenant_id, tenant_path, dept_id, dept_path
) VALUES (
    'GE-QUESTION-001', 'KF-DEMO-001', 'QUESTION', '一次函数应用题', '一次函数应用题', 'PENDING',
    '{"difficulty":"MEDIUM"}'::JSONB,
    '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/'
)
ON CONFLICT (entity_id) DO NOTHING;

INSERT INTO ai.tb_ai_graph_relation (
    relation_id, src_entity_id, dst_entity_id, relation_type, relation_name, relation_weight, sync_status, properties_json,
    adcode, tenant_id, tenant_path, dept_id, dept_path
) VALUES (
    'GR-001', 'GE-QUESTION-001', 'GE-KP-001', 'BELONGS_TO', '题目关联知识点', 1.0000, 'PENDING',
    '{"source":"manual_binding"}'::JSONB,
    '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/'
)
ON CONFLICT (relation_id) DO NOTHING;

INSERT INTO ai.tb_ai_knowledge_sync_task (
    task_id, file_id, target_store, task_type, task_status, payload_json,
    adcode, tenant_id, tenant_path, dept_id, dept_path
) VALUES (
    'KST-GRAPH-001', 'KF-DEMO-001', 'GRAPH', 'UPSERT', 'PENDING',
    '{"trigger":"seed","description":"sync to graph store"}'::JSONB,
    '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/'
)
ON CONFLICT (task_id) DO NOTHING;

INSERT INTO ai.tb_ai_knowledge_sync_task (
    task_id, file_id, target_store, task_type, task_status, payload_json,
    adcode, tenant_id, tenant_path, dept_id, dept_path
) VALUES (
    'KST-VECTOR-001', 'KF-DEMO-001', 'VECTOR', 'UPSERT', 'PENDING',
    '{"trigger":"seed","description":"sync to vector store"}'::JSONB,
    '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/'
)
ON CONFLICT (task_id) DO NOTHING;
