{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://schemas.api.finra.org/v1/reportCard/traceCorporateBondSummary.json",
    "type": "object",
    "properties": {
        "activityTotal": {
            "description": "Activity Totals section - summarizes total trade report entries and valid trade reports for the reporting period and prior month.",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "fieldName": { "type": "string", "description": "Identifies the row category (e.g. CustomerTrade, ReportSide, Matched, ATSTrade, AffiliateTrade, ReportedTrade)." },
                    "displayName": { "type": ["string", "null"], "description": "The UI-rendered label for this row (e.g. 'Customer Trades', 'Report Side', 'ATS Trades')." },
                    "group": { "type": ["string", "null"], "description": "Sub-grouping within the section (e.g. 'interDealer', 'lockedIntrade'). Null indicates a top-level row." },
                    "ReportEntryCount": { "type": "integer", "description": "Total number of transaction reports submitted by the firm during the month, including trades that were cancelled or reversed." },
                    "ValidReportCount": { "type": "integer", "description": "Number of total trade report entries that were not subsequently canceled during the report month or in the first three business days of the following month." },
                    "PriorMonthReportEntryCount": { "type": "integer", "description": "Total number of transaction reports submitted during the prior report month." },
                    "PriorMonthValidReportCount": { "type": "integer", "description": "Number of valid (not subsequently canceled) trade reports from the prior report month." }
                }
            }
        },
        "tradeReportingPeerGroup": {
            "description": "TRACE Reporting Peer Group section - provides peer group ranking based on total trade volume.",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "fieldName": { "type": "string", "description": "Row identifier (empty for peer group)." },
                    "displayName": { "type": ["string", "null"], "description": "UI label (null for peer group section)." },
                    "group": { "type": ["string", "null"], "description": "Sub-grouping (null for peer group)." },
                    "TotalNumberFirmsInCount": { "type": "integer", "description": "Number of firms included in the peer group based on total transaction reports for the selected reporting period." },
                    "TotalRankInNumber": { "type": "string", "description": "Rank of the firm relative to other firms in its peer group, based on number of trade reports submitted. Firms with more trade reports have a higher rank (1 = most)." },
                    "TotalNumber": { "type": "integer", "description": "The peer group tier number (1-4) based on valid trade report volume thresholds." }
                }
            }
        },
        "lateTrade": {
            "description": "Late Trades section - counts of trades reported after the allowable time, broken down by trade type (Customer, Inter-Dealer, Locked-In, Affiliate, All).",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "fieldName": { "type": "string", "description": "Row type: 'Total' (valid count or total late), 'SameDay' (late same day reports), or 'AsOf' (late as-of reports)." },
                    "displayName": { "type": ["string", "null"], "description": "UI label describing the specific metric (e.g. 'Late Same Day Customer Trade Reports', 'Total Late Trade Reports')." },
                    "group": { "type": ["string", "null"], "description": "Trade category: 'Customer', 'InterDealer', 'LockedIn', 'Affiliate', or 'All'." },
                    "Count": { "type": "integer", "description": "Number of late trades or total valid trade reports for the firm for the selected reporting period." },
                    "FirmPercent": { "type": "number", "description": "Percentage of late trades to total valid trade reports for the firm (Late % = Total Late / Total Valid Trade Reports)." },
                    "IndicatorAveragePercent": { "type": "number", "description": "Industry average: percentage of late trades to total valid trade reports for all firms having at least one valid trade for the selected reporting period." },
                    "PeerAveragePercent": { "type": "number", "description": "Peer average: percentage of late trades to total valid trade reports for all firms in the firm's peer group for the selected reporting period." },
                    "RankInPeerGroupNumber": { "type": "integer", "description": "Rank within peer group based on percentage of late trades. Firms are ranked ascending from lowest to highest percentage of late trades." },
                    "PriorMonthCount": { "type": "integer", "description": "Count of late trades for the prior reporting month." },
                    "PriorMonthCountPercentChange": { "type": "number", "description": "Percentage change in late trade count from prior month to current month." }
                }
            }
        },
        "tradeReportingAnalysis": {
            "description": "Trade Reporting Analysis section - flags trades that fall into exception categories. These do not definitively indicate problems but are flagged automatically.",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "fieldName": { "type": "string", "description": "Exception category identifier (e.g. 'NonMilitaryFormat', 'SameDayCancels', 'PriceOverride', 'ReportSideUnmatched', 'Early', 'Late', 'ModifierB')." },
                    "displayName": { "type": ["string", "null"], "description": "UI label for the exception type (e.g. 'Non-Military Format', 'Same Day Cancels', 'Report Side Unmatched', 'Trade Modifier B')." },
                    "group": { "type": ["string", "null"], "description": "Exception group: 'executionTime', 'amendedTradeReports', 'pricing', 'interDealer', 'executionTimeDifference', 'alternateATS', 'tradingModifier', or 'intraFirmReport'." },
                    "Count": { "type": "integer", "description": "Number of trade reports flagged for this exception category. Only valid trade reports are considered." },
                    "FirmPercent": { "type": "number", "description": "Percentage of flagged trades relative to the applicable denominator (valid trades, total trades, matched trades, or report/contra side trades depending on category)." },
                    "PeerAveragePercent": { "type": "number", "description": "Peer group average percentage for this exception category." },
                    "RankInPeerGroupNumber": { "type": "integer", "description": "Rank within peer group for this exception, ascending from lowest to highest percentage of alerts." },
                    "PriorMonthCount": { "type": "integer", "description": "Count of flagged trades for this exception in the prior month." },
                    "PriorMonthCountPercentChange": { "type": "number", "description": "Percentage change in flagged trade count from prior month to current month." }
                }
            }
        }
    }
}
