// AUTO-GENERATED by stele — do not edit.
// Source of truth: locales/*.json
import Foundation

public enum Locale: String {
    case en
    case es
    case pl
}

public struct Copy {
    let locale: Locale
    public init(_ locale: Locale) { self.locale = locale }
    public var home: Home { Home(locale) }
    public struct Home {
        let locale: Locale
        public init(_ locale: Locale) { self.locale = locale }
        public func greeting(name: String) -> String {
            SteleData.interp(SteleData.s(locale, "home.greeting"), ["name": name])
        }
        public func nearby(count: Int, radius: String) -> String {
            SteleData.plural(locale, "home.nearby", count, ["count": String(count), "radius": radius])
        }
        public var title: String { SteleData.s(locale, "home.title") }
    }
    public var inbox: Inbox { Inbox(locale) }
    public struct Inbox {
        let locale: Locale
        public init(_ locale: Locale) { self.locale = locale }
        public func unread(count: Int) -> String {
            SteleData.plural(locale, "inbox.unread", count, ["count": String(count)])
        }
    }
    public var walk: Walk { Walk(locale) }
    public struct Walk {
        let locale: Locale
        public init(_ locale: Locale) { self.locale = locale }
        public var cta: Cta { Cta(locale) }
        public struct Cta {
            let locale: Locale
            public init(_ locale: Locale) { self.locale = locale }
            public func confirm(dogName: String) -> String {
                SteleData.interp(SteleData.s(locale, "walk.cta.confirm"), ["dogName": dogName])
            }
            public var start: String { SteleData.s(locale, "walk.cta.start") }
        }
    }
}

enum SteleData {
    static let STRINGS: [String: [String: String]] = [
        "en": [
            "home.greeting": "Hey {name}, there are dogs nearby",
            "home.title": "Sidewalk",
            "walk.cta.confirm": "Hold to confirm walking {dogName}",
            "walk.cta.start": "Start walk",
        ],
        "es": [
            "home.greeting": "Hola {name}, hay perros cerca",
            "home.title": "Sidewalk",
            "walk.cta.confirm": "Mantén pulsado para pasear a {dogName}",
            "walk.cta.start": "Empezar paseo",
        ],
        "pl": [
            "home.greeting": "Cześć {name}, w pobliżu są psy",
            "home.title": "Sidewalk",
            "walk.cta.confirm": "Przytrzymaj, aby potwierdzić spacer z {dogName}",
            "walk.cta.start": "Rozpocznij spacer",
        ],
    ]
    static let PLURALS: [String: [String: [String: String]]] = [
        "en": [
            "home.nearby": ["one": "{count} dog within {radius} of you", "other": "{count} dogs within {radius} of you"],
            "inbox.unread": ["one": "{count} unread message", "other": "{count} unread messages"],
        ],
        "es": [
            "home.nearby": ["one": "{count} perro a {radius} de ti", "other": "{count} perros a {radius} de ti"],
            "inbox.unread": ["one": "{count} mensaje sin leer", "other": "{count} mensajes sin leer"],
        ],
        "pl": [
            "home.nearby": ["few": "{count} psy w odległości {radius} od Ciebie", "many": "{count} psów w odległości {radius} od Ciebie", "one": "{count} pies w odległości {radius} od Ciebie", "other": "{count} psa w odległości {radius} od Ciebie"],
            "inbox.unread": ["few": "{count} nieprzeczytane wiadomości", "many": "{count} nieprzeczytanych wiadomości", "one": "{count} nieprzeczytana wiadomość", "other": "{count} nieprzeczytanej wiadomości"],
        ],
    ]
    static let PCAT_SMALL: [String: String] = [
        "en": "o1oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
        "es": "o1oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
        "pl": "m1fffmmmmmmmmmmmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmm",
    ]
    static let PCAT_MOD: [String: String] = [
        "en": "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
        "es": "oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
        "pl": "mmfffmmmmmmmmmmmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmmmmfffmmmmm",
    ]
    static func pcode(_ c: Character) -> String {
        switch c {
        case "z": return "zero"
        case "1": return "one"
        case "2": return "two"
        case "f": return "few"
        case "m": return "many"
        default: return "other"
        }
    }
    static func pluralCategory(_ l: Locale, _ n: Int) -> String {
        let i = abs(n)
        let table = i < 100 ? (PCAT_SMALL[l.rawValue] ?? "") : (PCAT_MOD[l.rawValue] ?? "")
        let chars = Array(table)
        let idx = i < 100 ? i : i % 100
        return idx < chars.count ? pcode(chars[idx]) : "other"
    }
    static func s(_ l: Locale, _ k: String) -> String {
        STRINGS[l.rawValue]?[k] ?? k
    }
    static func interp(_ t: String, _ a: [String: String]) -> String {
        var out = t
        for (k, v) in a { out = out.replacingOccurrences(of: "{\(k)}", with: v) }
        return out
    }
    static func plural(_ l: Locale, _ k: String, _ n: Int, _ a: [String: String]) -> String {
        let forms = PLURALS[l.rawValue]?[k]
        let cat = pluralCategory(l, n)
        let t = forms?[cat] ?? forms?["other"] ?? ""
        return interp(t, a)
    }
}
