import Foundation

struct HermesSessionStartRequest: Codable {
    var externalRef: String?
    var localeCode: String?
    var devicePlatform: String?
    var deviceModel: String?
    var osVersion: String?
    var appVersion: String?
    var experimentVariant: String?
}

struct HermesSessionResponse: Codable {
    var sessionId: UUID
    var userId: UUID
    var startedAt: Date
    var endedAt: Date?
    var experimentVariant: String
    var appVersion: String
    var deviceModel: String?
    var osVersion: String?
    var localeCode: String
    var devicePlatform: String
}

struct HermesHealthResponse: Codable {
    var status: String
    var serviceName: String
    var environment: String
    var version: String
    var uptimeMs: Int
    var serverTime: Date
    var databaseReady: Bool
    var redisReady: Bool
}

struct HermesEvent: Codable {
    var id: UUID
    var sportType: String
    var sourceRef: String
    var titleEn: String
    var titleSv: String
    var status: String
    var previewStartMs: Int
    var previewEndMs: Int
    var revealStartMs: Int
    var revealEndMs: Int
    var lockAt: Date
    var settleAt: Date
}

struct HermesEventMedia: Codable {
    var id: UUID
    var eventId: UUID
    var mediaType: String
    var hlsMasterUrl: URL
    var posterUrl: URL?
    var durationMs: Int
    var previewStartMs: Int
    var previewEndMs: Int
    var revealStartMs: Int
    var revealEndMs: Int
}

struct HermesOutcome: Codable {
    var id: UUID
    var marketId: UUID
    var outcomeCode: String
    var labelKey: String
    var sortOrder: Int
}

struct HermesMarket: Codable {
    var id: UUID
    var eventId: UUID
    var questionKey: String
    var marketType: String
    var status: String
    var lockAt: Date
    var settlementRuleKey: String
    var outcomes: [HermesOutcome]
}

struct HermesOutcomeOdds: Codable {
    var id: UUID
    var oddsVersionId: UUID
    var outcomeId: UUID
    var decimalOdds: Double
    var fractionalNum: Int
    var fractionalDen: Int
}

struct HermesOddsVersion: Codable {
    var id: UUID
    var marketId: UUID
    var versionNo: Int
    var createdAt: Date
    var isCurrent: Bool
    var odds: [HermesOutcomeOdds]
}

struct HermesEventManifest: Codable {
    var event: HermesEvent
    var media: [HermesEventMedia]
    var markets: [HermesMarket]
}

struct HermesRound: Codable {
    var event: HermesEvent
    var media: HermesEventMedia
    var market: HermesMarket
    var oddsVersion: HermesOddsVersion
    var settlement: HermesSettlement
}

struct HermesBetIntentRequest: Codable {
    var sessionId: UUID
    var eventId: UUID
    var marketId: UUID
    var outcomeId: UUID
    var idempotencyKey: String
    var clientSentAt: Date
}

struct HermesBetIntentResponse: Codable {
    var id: UUID
    var accepted: Bool
    var acceptanceCode: String
    var acceptedOddsVersionId: UUID?
    var serverReceivedAt: Date
}

struct HermesSettlement: Codable {
    var id: UUID
    var marketId: UUID
    var settledAt: Date
    var winningOutcomeId: UUID
}

struct HermesAnalyticsAttributeInput: Codable {
    var key: String
    var value: String
}

struct HermesAnalyticsEventInput: Codable {
    var eventName: String
    var occurredAt: Date
    var attributes: [HermesAnalyticsAttributeInput]?
}

struct HermesAnalyticsBatchRequest: Codable {
    var events: [HermesAnalyticsEventInput]
}

struct HermesExperimentConfig: Codable {
    var variant: String
    var featureFlags: [String: Bool]
}

struct HermesLocalizationBundle: Codable {
    var localeCode: String
    var values: [String: String]
}
