using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Predictalytics.Infrastructure.Data;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddDbContext<AppDbContext>(opts => 
    opts.UseMySql(""Server=localhost;Database=Predictalytics_dev;User=root;Password="", ServerVersion.AutoDetect(""Server=localhost;Database=Predictalytics_dev;User=root;Password="")));
var sp = services.BuildServiceProvider();
var db = sp.GetRequiredService<AppDbContext>();

var total = db.Trades.Count();
var linked = db.Trades.Count(t => t.MarketOutcomeId != null && t.MarketOutcomeId != 0);
var unlinked = db.Trades.Count(t => t.MarketOutcomeId == null || t.MarketOutcomeId == 0);
var zero = db.Trades.Count(t => t.MarketOutcomeId == 0);

Console.WriteLine($""Total: {total}, Linked: {linked}, Unlinked: {unlinked}, Zero: {zero}"");
