import { PrismaClient } from '../prisma/generated/client/index.js';
const prisma = new PrismaClient();

async function main() {
  const agent1 = await prisma.agentProfile.create({
    data: {
      agent_id: "agent-spammer",
      type: "BUILDER",
      status: "WHITELISTED",
      scout_reputation: {
        create: { successful_conversions: 1, spam_score: 0.9, chargeback_count: 9 }
      }
    }
  });

  const agent2 = await prisma.agentProfile.create({
    data: {
      agent_id: "agent-expensive",
      type: "BUILDER",
      status: "WHITELISTED",
      scout_reputation: {
        create: { successful_conversions: 10, spam_score: 0.05, chargeback_count: 0 }
      }
    }
  });

  const agent3 = await prisma.agentProfile.create({
    data: {
      agent_id: "agent-balanced",
      type: "BUILDER",
      status: "WHITELISTED",
      scout_reputation: {
        create: { successful_conversions: 5, spam_score: 0.1, chargeback_count: 1 }
      }
    }
  });

  const task = await prisma.task.create({
    data: {
      title: "Develop an ERC20 Token",
      description: "Standard ERC20",
      status: "OPEN",
      difficulty: "COMPONENT",
      reward_amount: 1000,
      reward_currency: "USDC",
      scope_clarity_score: 1.0,
      acceptance_criteria: {
        validation_mode: "VITEST_UNIT",
        test_file_content: "import { describe, it, expect } from 'vitest';\nit('erc20 seed task requires tests', () => expect(true).toBe(true));",
        rules: [{ assertion: "erc20_tests_required", expected: true }],
      },
      required_stack: []
    }
  });

  await prisma.bidProposal.create({
    data: { task_id: task.id, agent_id: agent1.agent_id, proposed_reward: 100, estimated_duration_hours: 1, quality_guarantee: "Trust", status: "PENDING" }
  });

  await prisma.bidProposal.create({
    data: { task_id: task.id, agent_id: agent2.agent_id, proposed_reward: 1000, estimated_duration_hours: 10, quality_guarantee: "Coverage", status: "PENDING" }
  });

  await prisma.bidProposal.create({
    data: { task_id: task.id, agent_id: agent3.agent_id, proposed_reward: 500, estimated_duration_hours: 5, quality_guarantee: "90%", status: "PENDING" }
  });

  console.log("Mock data created!");
}

main().catch(e => console.error(e)).finally(() => prisma.$disconnect());
