//! Crate-embedded fallback snapshot.
//!
//! Used when the caller picks [`SnapshotSource::Embedded`] or when a remote
//! fetch fails and no local cache is present. Curated to anchor smoke tests
//! and offline development; not a substitute for the nightly materialized
//! universe.
//!
//! SIC codes verified against SEC EDGAR `data.sec.gov/submissions/CIK<...>.json`
//! at scaffold time.
//!
//! [`SnapshotSource::Embedded`]: crate::types::SnapshotSource::Embedded

use crate::sic::SecSector;
use crate::types::SectorMapping;

/// Inline (ticker, cik, sic_code, sic_desc, name) records bundled with the crate.
const EMBEDDED_ROWS: &[(&str, u64, u32, &str, &str)] = &[
    ("AAPL", 320193, 3571, "ELECTRONIC COMPUTERS", "Apple Inc."),
    (
        "MSFT",
        789019,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "MICROSOFT CORP",
    ),
    (
        "GOOGL",
        1652044,
        7370,
        "SERVICES-COMPUTER PROGRAMMING, DATA PROCESSING, ETC.",
        "Alphabet Inc.",
    ),
    (
        "AMZN",
        1018724,
        5961,
        "RETAIL-CATALOG, MAIL-ORDER HOUSES",
        "AMAZON COM INC",
    ),
    (
        "NVDA",
        1045810,
        3674,
        "SEMICONDUCTORS & RELATED DEVICES",
        "NVIDIA CORP",
    ),
    (
        "META",
        1326801,
        7370,
        "SERVICES-COMPUTER PROGRAMMING, DATA PROCESSING, ETC.",
        "Meta Platforms, Inc.",
    ),
    (
        "TSLA",
        1318605,
        3711,
        "MOTOR VEHICLES & PASSENGER CAR BODIES",
        "Tesla, Inc.",
    ),
    (
        "BRK-B",
        1067983,
        6311,
        "LIFE INSURANCE",
        "BERKSHIRE HATHAWAY INC",
    ),
    (
        "JPM",
        19617,
        6020,
        "STATE COMMERCIAL BANKS",
        "JPMORGAN CHASE & CO",
    ),
    (
        "V",
        1403161,
        7389,
        "SERVICES-BUSINESS SERVICES, NEC",
        "VISA INC.",
    ),
    (
        "UNH",
        731766,
        6324,
        "HOSPITAL & MEDICAL SERVICE PLANS",
        "UNITEDHEALTH GROUP INC",
    ),
    ("XOM", 34088, 2911, "PETROLEUM REFINING", "EXXON MOBIL CORP"),
    ("MA", 1141391, 6199, "FINANCE SERVICES", "MASTERCARD INC"),
    (
        "JNJ",
        200406,
        2834,
        "PHARMACEUTICAL PREPARATIONS",
        "JOHNSON & JOHNSON",
    ),
    (
        "PG",
        80424,
        2840,
        "SOAP, DETERGENTS, CLEANG PREPARATIONS, PERFUMES, COSMETICS",
        "PROCTER & GAMBLE CO",
    ),
    (
        "HD",
        354950,
        5211,
        "RETAIL-LUMBER & OTHER BUILDING MATERIALS DEALERS",
        "HOME DEPOT, INC.",
    ),
    (
        "BAC",
        70858,
        6020,
        "STATE COMMERCIAL BANKS",
        "BANK OF AMERICA CORP",
    ),
    (
        "AVGO",
        1730168,
        3674,
        "SEMICONDUCTORS & RELATED DEVICES",
        "Broadcom Inc.",
    ),
    ("CVX", 93410, 2911, "PETROLEUM REFINING", "CHEVRON CORP"),
    ("KO", 21344, 2080, "BEVERAGES", "COCA COLA CO"),
    ("PEP", 77476, 2080, "BEVERAGES", "PEPSICO INC"),
    ("WMT", 104169, 5331, "RETAIL-VARIETY STORES", "Walmart Inc."),
    (
        "DIS",
        1744489,
        7812,
        "SERVICES-MOTION PICTURE & VIDEO TAPE PRODUCTION",
        "Walt Disney Co",
    ),
    (
        "ABBV",
        1551152,
        2834,
        "PHARMACEUTICAL PREPARATIONS",
        "AbbVie Inc.",
    ),
    (
        "MRK",
        310158,
        2834,
        "PHARMACEUTICAL PREPARATIONS",
        "Merck & Co., Inc.",
    ),
    (
        "PFE",
        78003,
        2834,
        "PHARMACEUTICAL PREPARATIONS",
        "PFIZER INC",
    ),
    (
        "CSCO",
        858877,
        3576,
        "COMPUTER COMMUNICATIONS EQUIPMENT",
        "CISCO SYSTEMS, INC.",
    ),
    (
        "ORCL",
        1341439,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "ORACLE CORP",
    ),
    (
        "INTC",
        50863,
        3674,
        "SEMICONDUCTORS & RELATED DEVICES",
        "INTEL CORP",
    ),
    (
        "AMD",
        2488,
        3674,
        "SEMICONDUCTORS & RELATED DEVICES",
        "Advanced Micro Devices, Inc.",
    ),
    (
        "CRM",
        1108524,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "Salesforce, Inc.",
    ),
    (
        "NFLX",
        1065280,
        7841,
        "SERVICES-VIDEO TAPE RENTAL",
        "NETFLIX INC",
    ),
    (
        "NKE",
        320187,
        3021,
        "RUBBER & PLASTICS FOOTWEAR",
        "NIKE, Inc.",
    ),
    (
        "MCD",
        63908,
        5812,
        "RETAIL-EATING PLACES",
        "McDonald's Corp",
    ),
    (
        "LIN",
        1707925,
        2810,
        "INDUSTRIAL INORGANIC CHEMICALS",
        "Linde plc",
    ),
    (
        "T",
        732717,
        4813,
        "TELEPHONE COMMUNICATIONS (NO RADIOTELEPHONE)",
        "AT&T INC.",
    ),
    (
        "VZ",
        732712,
        4813,
        "TELEPHONE COMMUNICATIONS (NO RADIOTELEPHONE)",
        "VERIZON COMMUNICATIONS INC",
    ),
    (
        "ADBE",
        796343,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "ADOBE INC.",
    ),
    (
        "QCOM",
        804328,
        3674,
        "SEMICONDUCTORS & RELATED DEVICES",
        "QUALCOMM INC/DE",
    ),
    (
        "TXN",
        97476,
        3674,
        "SEMICONDUCTORS & RELATED DEVICES",
        "TEXAS INSTRUMENTS INC",
    ),
    (
        "UPS",
        1090727,
        4513,
        "AIR COURIER SERVICES",
        "United Parcel Service, Inc.",
    ),
    ("FDX", 1048911, 4513, "AIR COURIER SERVICES", "FedEx Corp"),
    ("BA", 12927, 3721, "AIRCRAFT", "BOEING CO"),
    (
        "CAT",
        18230,
        3531,
        "CONSTRUCTION MACHINERY & EQUIP",
        "CATERPILLAR INC",
    ),
    (
        "GE",
        40545,
        3724,
        "AIRCRAFT ENGINES & ENGINE PARTS",
        "GE Aerospace",
    ),
    (
        "HON",
        773840,
        3812,
        "SEARCH, DETECTION, NAVIGATION, GUIDANCE, AERONAUTICAL SYS",
        "HONEYWELL INTERNATIONAL INC",
    ),
    (
        "LMT",
        936468,
        3812,
        "SEARCH, DETECTION, NAVIGATION, GUIDANCE, AERONAUTICAL SYS",
        "LOCKHEED MARTIN CORP",
    ),
    (
        "RTX",
        101829,
        3724,
        "AIRCRAFT ENGINES & ENGINE PARTS",
        "RTX Corp",
    ),
    (
        "GS",
        886982,
        6199,
        "FINANCE SERVICES",
        "GOLDMAN SACHS GROUP INC",
    ),
    ("MS", 895421, 6199, "FINANCE SERVICES", "MORGAN STANLEY"),
    ("C", 831001, 6020, "STATE COMMERCIAL BANKS", "CITIGROUP INC"),
    (
        "WFC",
        72971,
        6020,
        "STATE COMMERCIAL BANKS",
        "WELLS FARGO & COMPANY/MN",
    ),
    ("BLK", 1364742, 6282, "INVESTMENT ADVICE", "BlackRock, Inc."),
    (
        "SPGI",
        64040,
        7389,
        "SERVICES-BUSINESS SERVICES, NEC",
        "S&P Global Inc.",
    ),
    ("AXP", 4962, 6199, "FINANCE SERVICES", "AMERICAN EXPRESS CO"),
    (
        "COST",
        909832,
        5331,
        "RETAIL-VARIETY STORES",
        "COSTCO WHOLESALE CORP /NEW",
    ),
    ("TGT", 27419, 5331, "RETAIL-VARIETY STORES", "TARGET CORP"),
    (
        "LOW",
        60667,
        5211,
        "RETAIL-LUMBER & OTHER BUILDING MATERIALS DEALERS",
        "LOWE'S COS INC",
    ),
    (
        "SBUX",
        829224,
        5812,
        "RETAIL-EATING PLACES",
        "STARBUCKS CORP",
    ),
    (
        "ABNB",
        1559720,
        7389,
        "SERVICES-BUSINESS SERVICES, NEC",
        "Airbnb, Inc.",
    ),
    (
        "UBER",
        1543151,
        7389,
        "SERVICES-BUSINESS SERVICES, NEC",
        "Uber Technologies, Inc",
    ),
    (
        "LYFT",
        1759509,
        7389,
        "SERVICES-BUSINESS SERVICES, NEC",
        "Lyft, Inc.",
    ),
    (
        "PYPL",
        1633917,
        7389,
        "SERVICES-BUSINESS SERVICES, NEC",
        "PayPal Holdings, Inc.",
    ),
    (
        "SQ",
        1512673,
        7389,
        "SERVICES-BUSINESS SERVICES, NEC",
        "Block, Inc.",
    ),
    (
        "SHOP",
        1594805,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "Shopify Inc.",
    ),
    (
        "MDB",
        1441816,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "MongoDB, Inc.",
    ),
    (
        "SNOW",
        1640147,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "Snowflake Inc.",
    ),
    (
        "PLTR",
        1321655,
        7372,
        "SERVICES-PREPACKAGED SOFTWARE",
        "Palantir Technologies Inc.",
    ),
    (
        "COIN",
        1679788,
        6199,
        "FINANCE SERVICES",
        "Coinbase Global, Inc.",
    ),
    (
        "HOOD",
        1783879,
        6199,
        "FINANCE SERVICES",
        "Robinhood Markets, Inc.",
    ),
    (
        "F",
        37996,
        3711,
        "MOTOR VEHICLES & PASSENGER CAR BODIES",
        "FORD MOTOR CO",
    ),
    (
        "GM",
        1467858,
        3711,
        "MOTOR VEHICLES & PASSENGER CAR BODIES",
        "GENERAL MOTORS CO",
    ),
    (
        "RIVN",
        1874178,
        3711,
        "MOTOR VEHICLES & PASSENGER CAR BODIES",
        "Rivian Automotive, Inc.",
    ),
    (
        "LCID",
        1811210,
        3711,
        "MOTOR VEHICLES & PASSENGER CAR BODIES",
        "Lucid Group, Inc.",
    ),
    (
        "LLY",
        59478,
        2834,
        "PHARMACEUTICAL PREPARATIONS",
        "ELI LILLY & Co",
    ),
    (
        "BMY",
        14272,
        2834,
        "PHARMACEUTICAL PREPARATIONS",
        "BRISTOL MYERS SQUIBB CO",
    ),
    (
        "GILD",
        882095,
        2836,
        "PHARMACEUTICAL PREPARATIONS BIOLOGICAL PRODUCTS, (NO DIAGNOSTIC SUBSTANCES)",
        "GILEAD SCIENCES INC",
    ),
    (
        "AMGN",
        318154,
        2836,
        "PHARMACEUTICAL PREPARATIONS BIOLOGICAL PRODUCTS, (NO DIAGNOSTIC SUBSTANCES)",
        "AMGEN INC",
    ),
    (
        "REGN",
        872589,
        2836,
        "PHARMACEUTICAL PREPARATIONS BIOLOGICAL PRODUCTS, (NO DIAGNOSTIC SUBSTANCES)",
        "REGENERON PHARMACEUTICALS, INC.",
    ),
    (
        "VRTX",
        875320,
        2836,
        "PHARMACEUTICAL PREPARATIONS BIOLOGICAL PRODUCTS, (NO DIAGNOSTIC SUBSTANCES)",
        "VERTEX PHARMACEUTICALS INC / MA",
    ),
    (
        "MDLZ",
        1103982,
        2052,
        "COOKIES & CRACKERS",
        "Mondelez International, Inc.",
    ),
    ("MO", 764180, 2111, "CIGARETTES", "Altria Group, Inc."),
    (
        "PM",
        1413329,
        2111,
        "CIGARETTES",
        "PHILIP MORRIS INTERNATIONAL INC.",
    ),
    (
        "CL",
        21665,
        2840,
        "SOAP, DETERGENTS, CLEANG PREPARATIONS, PERFUMES, COSMETICS",
        "COLGATE PALMOLIVE CO",
    ),
    (
        "UNP",
        100885,
        4011,
        "RAILROADS, LINE-HAUL OPERATING",
        "UNION PACIFIC CORP",
    ),
    (
        "CSX",
        277948,
        4011,
        "RAILROADS, LINE-HAUL OPERATING",
        "CSX CORP",
    ),
    (
        "NSC",
        702165,
        4011,
        "RAILROADS, LINE-HAUL OPERATING",
        "NORFOLK SOUTHERN CORP",
    ),
    (
        "DAL",
        27904,
        4512,
        "AIR TRANSPORTATION, SCHEDULED",
        "DELTA AIR LINES, INC.",
    ),
    (
        "UAL",
        100517,
        4512,
        "AIR TRANSPORTATION, SCHEDULED",
        "UNITED AIRLINES HOLDINGS, INC.",
    ),
    (
        "AAL",
        6201,
        4512,
        "AIR TRANSPORTATION, SCHEDULED",
        "AMERICAN AIRLINES GROUP INC.",
    ),
    (
        "LUV",
        92380,
        4512,
        "AIR TRANSPORTATION, SCHEDULED",
        "SOUTHWEST AIRLINES CO",
    ),
    (
        "DUK",
        1326160,
        4931,
        "ELECTRIC & OTHER SERVICES COMBINED",
        "DUKE ENERGY CORP",
    ),
    ("SO", 92122, 4911, "ELECTRIC SERVICES", "SOUTHERN CO"),
    (
        "NEE",
        753308,
        4931,
        "ELECTRIC & OTHER SERVICES COMBINED",
        "NEXTERA ENERGY INC",
    ),
    (
        "D",
        715957,
        4931,
        "ELECTRIC & OTHER SERVICES COMBINED",
        "DOMINION ENERGY, INC.",
    ),
    (
        "EQIX",
        1101239,
        6798,
        "REAL ESTATE INVESTMENT TRUSTS",
        "EQUINIX INC",
    ),
    (
        "AMT",
        1053507,
        6798,
        "REAL ESTATE INVESTMENT TRUSTS",
        "AMERICAN TOWER CORP /MA/",
    ),
    (
        "PLD",
        1045609,
        6798,
        "REAL ESTATE INVESTMENT TRUSTS",
        "PROLOGIS, INC.",
    ),
    (
        "PSA",
        1393311,
        6798,
        "REAL ESTATE INVESTMENT TRUSTS",
        "Public Storage",
    ),
    (
        "CCI",
        1051470,
        6798,
        "REAL ESTATE INVESTMENT TRUSTS",
        "CROWN CASTLE INC.",
    ),
    (
        "O",
        726728,
        6798,
        "REAL ESTATE INVESTMENT TRUSTS",
        "Realty Income Corp",
    ),
    (
        "SCHW",
        316709,
        6199,
        "FINANCE SERVICES",
        "SCHWAB CHARLES CORP",
    ),
    ("CB", 896159, 6311, "LIFE INSURANCE", "CHUBB LTD"),
    (
        "PGR",
        80661,
        6321,
        "ACCIDENT & HEALTH INSURANCE",
        "PROGRESSIVE CORP/OH/",
    ),
    (
        "TRV",
        86312,
        6321,
        "ACCIDENT & HEALTH INSURANCE",
        "TRAVELERS COMPANIES, INC.",
    ),
];

/// Build the embedded snapshot as a vector.
pub fn embedded_rows() -> Vec<SectorMapping> {
    EMBEDDED_ROWS
        .iter()
        .map(|&(ticker, cik, sic_code, sic_desc, name)| SectorMapping {
            ticker: ticker.to_string(),
            cik,
            sic_code,
            sic_desc: sic_desc.to_string(),
            sector: SecSector::from_sic(sic_code),
            name: name.to_string(),
        })
        .collect()
}

/// Count of rows in the embedded snapshot.
pub const fn embedded_count() -> usize {
    EMBEDDED_ROWS.len()
}
