using Predictalytics.Domain.Enums;
namespace Predictalytics.Domain.Entities;
///
/// Represents a prediction market (event/question).
///
public class Market
{
public int Id { get; set; }
/// Platform this market belongs to.
public PlatformType Platform { get; set; }
/// The Event this market belongs to.
public int EventId { get; set; }
public virtual Event Event { get; set; } = null!;
/// Platform-specific numeric market identifier.
public long PlatformMarketId { get; set; }
/// Platform-specific blockchain market identifier (conditionId on Polymarket).
public string ConditionId { get; set; } = string.Empty;
/// Smart contract question ID.
public string QuestionId { get; set; } = string.Empty;
/// URL-friendly slug for the market.
public string MarketSlug { get; set; } = string.Empty;
/// Detailed market description / resolution criteria.
public string? Description { get; set; }
/// Market image URL.
public string? ImageUrl { get; set; }
/// The question being predicted.
public string Question { get; set; } = string.Empty;
/// Category / tag (e.g. "Politics", "Crypto", "Sports").
public MarketCategory Category { get; set; }
/// Subcategory (e.g. "Basketball", "Elections", "Bitcoin").
public string Subcategory { get; set; } = string.Empty;
/// Current total volume traded.
public decimal Volume { get; set; }
/// Current 24h volume.
public decimal Volume24h { get; set; }
/// Current liquidity.
public decimal Liquidity { get; set; }
/// The time when trading opened for this market.
public DateTime? StartDate { get; set; }
/// When the market closes / resolves.
public DateTime? EndDate { get; set; }
public DateTime? ClosedAt { get; set; }
/// Whether the market has been resolved.
public bool IsResolved { get; set; }
/// Resolution outcome (if resolved).
public string? ResolutionOutcome { get; set; }
public decimal FeeRateBps { get; set; }
public bool IsNegRisk { get; set; }
/// When this market was created on the platform.
public DateTime CreatedAt { get; set; }
/// When this record was first saved to our database.
public DateTime DbCreatedAt { get; set; } = DateTime.UtcNow;
/// Last time market data was refreshed.
public DateTime? LastUpdatedAt { get; set; }
/// Last time market trades were polled for trader discovery.
public DateTime? LastTradesUpdatedAt { get; set; }
// Navigation
public ICollection Outcomes { get; set; } = new List();
public virtual MarketAnalytics? Analytics { get; set; }
}