"""Cosine Textiles mill list. Colour cards stay empty until the next sheet."""

FIBRE_KEYS = (
    "cotton",
    "polyester",
    "spandex",
    "nylon",
    "modal",
    "linen",
    "tencel",
    "wool",
    "other",
)

BUYER_CREDENTIAL = {
    "email": "buyer@cosinecreate.com",
    "password": "Buyer123!",
    "name": "Cosine Textiles",
    "role": "buyer",
    "brand": "Cosine Textiles",
    "client_slug": "cosine-textiles",
}


def _f(**parts):
    return {key: parts[key] for key in FIBRE_KEYS if parts.get(key)}


def _line(supplier, code, kind, fibres, gsm, kg=None, meter=None, usage="", colors=None):
    kg = kg or {}
    meter = meter or {}
    return {
        "supplier": supplier or "",
        "code": code,
        "kind": kind,
        "fibres": fibres,
        "gsm": gsm,
        "price_kg_cny": kg.get("cny"),
        "price_kg_kes": kg.get("kes"),
        "price_kg_cosintex": kg.get("cosintex"),
        "price_m_cny": meter.get("cny"),
        "price_m_kes": meter.get("kes"),
        "price_m_cosintex": meter.get("cosintex"),
        "usage": usage or "",
        "colors": list(colors or []),
    }


# Mill CNY → KES at ~19.5. Cosintex add-on: +200 /kg, +50 /m where filled.
FABRIC_ROWS = [
    _line("JUGENG", "B1976", "T-SHIRT", _f(cotton=52, polyester=41, spandex=7), 239,
          kg={"cny": 54.70, "kes": 1067, "cosintex": 1267},
          meter={"cny": 21.50, "kes": 419.25, "cosintex": 469.25}),
    _line("JUGENG", "A1899", "T-SHIRT", _f(cotton=58, polyester=42), 266,
          kg={"cny": 49.22, "kes": 960, "cosintex": 1160},
          meter={"cny": 22.00, "kes": 429, "cosintex": 479}),
    _line("JUGENG", "A1868", "T-SHIRT", _f(cotton=97, polyester=3), 263,
          kg={"cny": 57.24, "kes": 1116, "cosintex": 1316},
          meter={"cny": 23.00, "kes": 448.5, "cosintex": 498.50}),
    _line("JUGENG", "A1887", "T-SHIRT", _f(cotton=63, polyester=37), 239,
          kg={"cny": 62.06, "kes": 1210, "cosintex": 1410},
          meter={"cny": 25.00, "kes": 487.5, "cosintex": 537.50}),
    _line("JUGENG", "A1885", "T-SHIRT", _f(cotton=56, polyester=44), 199,
          kg={"cny": 50.29, "kes": 981, "cosintex": 1181},
          meter={"cny": 17.00, "kes": 331.5, "cosintex": 381.50}),
    _line("JUGENG", "B1725", "T-SHIRT", _f(cotton=82, polyester=18), 310,
          kg={"cny": 50.29, "kes": 981, "cosintex": 1181},
          meter={"cny": 25.00, "kes": 487.5, "cosintex": 537.50}),
    _line("JUGENG", "A1876", "T-SHIRT", _f(cotton=85, polyester=15), 260,
          kg={"cny": 64.20, "kes": 1252, "cosintex": 1452},
          meter={"cny": 28.00, "kes": 546, "cosintex": 596}),
    _line("JUGENG", "B1972", "T-SHIRT", _f(cotton=54, polyester=36, spandex=10), 303,
          kg={"cny": 46.64, "kes": 909, "cosintex": 1109},
          meter={"cny": 24.50, "kes": 477.75, "cosintex": 527.75}),
    _line("JUGENG", "B1787", "T-SHIRT", _f(cotton=50, polyester=45, spandex=5), 166,
          kg={"cny": 68.60, "kes": 1338, "cosintex": 1538},
          meter={"cny": 18.00, "kes": 351, "cosintex": 401}),
    _line("JUGENG", "A1865", "T-SHIRT", _f(cotton=83, polyester=17), 222,
          kg={"cny": 67.31, "kes": 1313, "cosintex": 1513},
          meter={"cny": 24.50, "kes": 477.75, "cosintex": 527.75}),
    _line("JUGENG", "A1876", "T-SHIRT", _f(cotton=85, polyester=15), 260,
          kg={"cny": 63.60, "kes": 1240, "cosintex": 1440},
          meter={"cny": 27.50, "kes": 536.25, "cosintex": 586.25}),
    _line("JUGENG", "B1789", "T-SHIRT", _f(cotton=100), 216,
          kg={"cny": 49.76, "kes": 970, "cosintex": 1170},
          meter={"cny": 17.50, "kes": 341.25, "cosintex": 391.25}),
    _line("JUGENG", "B1788", "T-SHIRT", _f(cotton=100), 194,
          kg={"cny": 50.83, "kes": 991, "cosintex": 1191},
          meter={"cny": 16.00, "kes": 312, "cosintex": 362}),
    _line("JUGENG", "B1969", "T-SHIRT", _f(cotton=100), 222,
          kg={"cny": 53.39, "kes": 1041, "cosintex": 1241},
          meter={"cny": 19.50, "kes": 380.25, "cosintex": 430.25}),
    _line("JUGENG", "B1909", "T-SHIRT", _f(cotton=100), 314,
          kg={"cny": 63.60, "kes": 1240, "cosintex": 1440},
          meter={"cny": 35.00, "kes": 682.5, "cosintex": 732.50}),
    _line("JUGENG", "B1705", "T-SHIRT", _f(cotton=100), 271,
          kg={"cny": 50.88, "kes": 992, "cosintex": 1192},
          meter={"cny": 24.00, "kes": 468, "cosintex": 518}),
    _line("JUGENG", "B1816", "T-SHIRT", _f(cotton=100), 294,
          kg={"cny": 44.25, "kes": 863, "cosintex": 1063},
          meter={"cny": 21.50, "kes": 419.25, "cosintex": 469.25}),
    _line("JUGENG", "B1696", "FLEECE", _f(cotton=87, polyester=13), 404,
          kg={"cny": 47.17, "kes": 920, "cosintex": 1120},
          meter={"cny": 30.50, "kes": 594.75, "cosintex": 644.75}),
    _line("JUGENG", "B1727", "FLEECE", _f(cotton=48, polyester=52), 416,
          kg={"cny": 44.52, "kes": 868, "cosintex": 1068},
          meter={"cny": 30.50, "kes": 594.75, "cosintex": 644.75}),
    _line("JUGENG", "B1879", "FLEECE", _f(cotton=64, polyester=36), 404,
          kg={"cny": 40.28, "kes": 785, "cosintex": 985},
          meter={"cny": 27.50, "kes": 536.25, "cosintex": 586.25}),
    _line("JUGENG", "A1760", "FLEECE", _f(cotton=32, polyester=68), 360,
          kg={"cny": 46.64, "kes": 909, "cosintex": 1109},
          meter={"cny": 26.50, "kes": 516.75, "cosintex": 566.75}),
    _line("JUGENG", "B1736", "FLEECE", _f(cotton=42, polyester=53, other=5), 382,
          kg={"cny": 36.04, "kes": 703, "cosintex": 903},
          meter={"cny": 23.00, "kes": 448.5, "cosintex": 498.50}),
    _line("JUGENG", "B1721", "FLEECE", _f(cotton=84, polyester=16), 404,
          kg={"cny": 47.17, "kes": 920, "cosintex": 1120},
          meter={"cny": 31.50, "kes": 614.25, "cosintex": 664.25}),
    _line("JUGENG", "B1882", "FLEECE", _f(cotton=38, polyester=57, other=5), 338,
          kg={"cny": 37.45, "kes": 730, "cosintex": 930},
          meter={"cny": 21.50, "kes": 419.25, "cosintex": 469.25}),
    _line("JUGENG", "B1833", "FLEECE", _f(cotton=49, polyester=51), 465,
          kg={"cny": 43.46, "kes": 847},
          meter={"cny": 33.00, "kes": 643.5}),
    _line("", "SZ2001", "LINEN", _f(linen=100), 235,
          kg={"kes": 0, "cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "SZ4821", "LINEN", _f(linen=100), 200,
          kg={"kes": 0, "cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "324", "LINEN", _f(linen=25, tencel=75), 160,
          kg={"kes": 0, "cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "SZ6723", "LINEN", _f(cotton=45, linen=55), 170,
          kg={"kes": 0, "cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "SZ3248", "LINEN", _f(linen=30, wool=70), 160,
          kg={"kes": 0, "cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "SZ4816", "LINEN", _f(linen=100), 167,
          kg={"kes": 0, "cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "SZ101", "LINEN", _f(linen=100), 155,
          kg={"kes": 0, "cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "SZ2008", "LINEN", _f(linen=100), 184,
          kg={"cosintex": 200}, meter={"kes": 0, "cosintex": 50}),
    _line("", "M1618", "LINEN", _f(cotton=85, linen=15), 220,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("", "SZ2966", "LINEN", _f(linen=30, tencel=70), 190,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("", "SZM1620", "LINEN", _f(cotton=67, linen=30, other=3), 174,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("", "8514", "LINEN", _f(cotton=40, linen=60), 182,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("", "SZ9607", "LINEN", _f(other=100), 215,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("", "SZ5668", "LINEN", _f(cotton=40, linen=60), 210,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ187", "SPORTS/POLO", _f(polyester=90, spandex=10), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ108", "SPORTS/POLO", _f(polyester=85, spandex=15), 150,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ215", "SPORTS/POLO", _f(polyester=96, spandex=4), 205,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ094-3", "SPORTS/POLO", _f(cotton=66, polyester=34), 220,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ010-4", "SPORTS/POLO", _f(cotton=100), 220,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ6688", "SPORTS/POLO", _f(polyester=81, spandex=19), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ183", "SPORTS/POLO", _f(polyester=93, spandex=7), 165,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ701", "SPORTS/POLO", _f(polyester=86, spandex=14), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ293", "SPORTS/POLO", _f(cotton=69, polyester=31), 190,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ5399", "SPORTS/POLO", _f(cotton=75, polyester=18, spandex=7), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ716", "SPORTS/POLO", _f(polyester=89, spandex=11), 190,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ704", "SPORTS/POLO", _f(polyester=83, spandex=17), 175,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ718", "SPORTS/POLO", _f(polyester=76, spandex=24), 165,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ6619", "SPORTS/POLO", _f(polyester=78, spandex=22), 165,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YAZI BUYE", "YZ30068", "SPORTS/POLO", _f(polyester=82, spandex=18), 180),
    _line("YAZI BUYE", "YZ381", "SPORTS/POLO", _f(polyester=90, spandex=10), 165),
    _line("YAZI BUYE", "YZ20256", "SPORTS/POLO", _f(polyester=85, spandex=15), 180),
    _line("WXI GARDENIA", "Z142606", "WOOL", _f(wool=50, other=50), 400,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("WXI GARDENIA", "Z142603", "WOOL", _f(wool=50, other=50), 400,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YUNXIANG TEXTILES", "NT1085", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 208,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("YUNXIANG TEXTILES", "95869", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 150,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="OUTDOOR JACKETS"),
    _line("YUNXIANG TEXTILES", "95867", "SPORTS/ JACKET", _f(polyester=90, spandex=10), 160,
          kg={"cosintex": 200}, meter={"cosintex": 50},
          usage="OUTDOOR CLOTHES, COATS & JACKETS (WATERPROOF)"),
    _line("YUNXIANG TEXTILES", "95860", "SPORTS/ JACKET", _f(polyester=90, spandex=10), 140,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="OUTDOOR CLOTHES & COATS"),
    _line("YUNXIANG TEXTILES", "95876", "SPORTS/ JACKET", _f(polyester=95, spandex=5), 150,
          kg={"cosintex": 200}, meter={"cosintex": 50},
          usage="OUTDOOR CLOTHES, COATS & JACKETS (WATERPROOF)"),
    _line("YUNXIANG TEXTILES", "NT1030", "SPORTS/ JACKET", _f(polyester=90, spandex=10), 155,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="WINDBREAKER & COAT"),
    _line("YUNXIANG TEXTILES", "NT1031", "SPORTS/ JACKET", _f(polyester=90, spandex=10), 140,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="WINDBREAKER JACKET"),
    _line("YUNXIANG TEXTILES", "95874", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 140,
          kg={"cosintex": 200}, meter={"cosintex": 50},
          usage="OUTDOOR CLOTHES, COATS & JACKETS (WATERPROOF)"),
    _line("YUNXIANG TEXTILES", "NT1074", "SPORTS/ JACKET", _f(polyester=95, spandex=5), 270,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="WINDBREAKER JACKET"),
    _line("YUNXIANG TEXTILES", "NT1078/M/T", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 160,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="OUTDOOR CLOTHES"),
    _line("YUNXIANG TEXTILES", "NT1065", "SPORTS/ JACKET", _f(tencel=100), 148,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="WINDBREAKER JACKET"),
    _line("YUNXIANG TEXTILES", "95875", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="OUTDOOR CLOTHES"),
    _line("YUNXIANG TEXTILES", "95871", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="WINDBREAKER OUTDOOR"),
    _line("YUNXIANG TEXTILES", "96865", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 270,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="OUTDOOR WINDBREAKER"),
    _line("YUNXIANG TEXTILES", "95860", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="OUTDOOR CLOTHES"),
    _line("YUNXIANG TEXTILES", "95207", "SPORTS/ JACKET", _f(polyester=90, spandex=10), 160,
          kg={"cosintex": 200}, meter={"cosintex": 50},
          usage="OUTDOOR CLOTHES, COATS & JACKETS (WATERPROOF)"),
    _line("YUNXIANG TEXTILES", "95733", "SPORTS/ JACKET", _f(polyester=88, spandex=12), 200,
          kg={"cosintex": 200}, meter={"cosintex": 50}, usage="OUTDOOR WINDBREAKER"),
    _line("UNIWINN", "UG8150", "OUTDOOR JACKET", _f(polyester=100), None,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("UNIWINN", "UG805", "OUTDOOR JACKET", _f(polyester=100), None,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("UNIWINN", "UG8126", "OUTDOOR JACKET", _f(polyester=100), None,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("PONGEE POLYESTER", "CFT-1002", "OUTDOOR JACKET", _f(polyester=100), 56,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "NSI210", "LEGGING", _f(spandex=25, nylon=75), 210,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "PS1230", "LEGGING", _f(polyester=78, spandex=22), 230,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "NSI180", "LEGGING", _f(spandex=15, nylon=85), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "PSI230", "LEGGING", _f(polyester=78, spandex=22), 230,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "NSI220", "LEGGING", _f(polyester=75, spandex=25), 220,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "PP220", "SPORTS/POLO", _f(polyester=100), 230,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "NSN200", "WORKOUT TEE", _f(spandex=21, nylon=79), 200,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("LIAHREN", "NSPIQUE180", "WORKOUT TEE", _f(spandex=10, nylon=90), 180,
          kg={"cosintex": 200}, meter={"cosintex": 50}),
    _line("", "40s/2", "THREAD", _f(polyester=100), None, usage="40s/2"),
    _line("", "210 D/3", "THREAD", _f(nylon=100), None, usage="210 D/3"),
]
