import Foundation
import SharedModels

struct GrammarNote: Identifiable {
    let id: String
    let title: String
    let category: String
    let body: String

    static let allNotes: [GrammarNote] = [
        serVsEstar,
        porVsPara,
        preteriteVsImperfect,
        subjunctiveTriggers,
        reflexiveVerbs,
        objectPronouns,
        gustarLikeVerbs,
        comparativesSuperlatives,
        conditionalIfClauses,
        commandsImperative,
        saberVsConocer,
        doubleNegatives,
        adjectivePlacement,
        tenerExpressions,
        personalA,
        relativePronouns,
        futureVsIrA,
        accentMarksStress,
        seConstructions,
        estarGerundProgressive,
    ]

    // MARK: - 1. Ser vs Estar

    private static let serVsEstar = GrammarNote(
        id: "ser-vs-estar",
        title: "Ser vs Estar",
        category: "Core Concepts",
        body: """
        Spanish has two verbs meaning "to be": *ser* and *estar*. Choosing the wrong one changes the meaning of a sentence entirely.

        **Ser** is used for permanent or inherent qualities — identity, origin, profession, time, physical descriptions that don't change, and personality traits. Think of ser as describing *what* something is.

        *Ella es doctora.* — She is a doctor.
        *Nosotros somos de México.* — We are from Mexico.
        *Son las tres de la tarde.* — It is three in the afternoon.
        *Mi hermano es alto y simpático.* — My brother is tall and friendly.
        *La fiesta es en mi casa.* — The party is at my house.

        **Estar** is used for temporary states, locations, emotions, conditions, and the results of actions. Think of estar as describing *how* something is right now.

        *Estoy cansado hoy.* — I am tired today.
        *El libro está en la mesa.* — The book is on the table.
        *Ella está feliz porque aprobó el examen.* — She is happy because she passed the exam.
        *La sopa está caliente.* — The soup is hot.
        *Estamos estudiando español.* — We are studying Spanish.

        **Key trick:** Some adjectives change meaning depending on which verb you use.

        *Él es aburrido.* — He is boring (personality trait).
        *Él está aburrido.* — He is bored (temporary feeling).
        *Ella es lista.* — She is clever.
        *Ella está lista.* — She is ready.
        *La manzana es verde.* — The apple is green (its natural color).
        *La manzana está verde.* — The apple is unripe.

        **Memory aid:** Use the acronym DOCTOR for ser (Description, Occupation, Characteristic, Time, Origin, Relationship) and PLACE for estar (Position, Location, Action in progress, Condition, Emotion).
        """
    )

    // MARK: - 2. Por vs Para

    private static let porVsPara = GrammarNote(
        id: "por-vs-para",
        title: "Por vs Para",
        category: "Core Concepts",
        body: """
        Both *por* and *para* translate to "for" in English, but they are not interchangeable. Each has distinct uses.

        **Para** indicates purpose, destination, recipient, deadline, or goal — it points forward toward something.

        *Este regalo es para ti.* — This gift is for you (recipient).
        *Salimos para Madrid mañana.* — We leave for Madrid tomorrow (destination).
        *Estudio para aprender.* — I study in order to learn (purpose).
        *Necesito el informe para el lunes.* — I need the report by Monday (deadline).
        *Para ser estudiante, habla muy bien.* — For a student, she speaks very well (comparison).

        **Por** indicates cause, exchange, duration, movement through, or means — it looks back at the reason or path behind something.

        *Gracias por tu ayuda.* — Thanks for your help (cause/reason).
        *Pagué veinte dólares por el libro.* — I paid twenty dollars for the book (exchange).
        *Caminamos por el parque.* — We walked through the park (movement through).
        *Estudié por dos horas.* — I studied for two hours (duration).
        *Te llamo por teléfono.* — I'll call you by phone (means).
        *La carta fue escrita por María.* — The letter was written by María (agent in passive voice).

        **Common fixed expressions with por:** *por favor* (please), *por supuesto* (of course), *por ejemplo* (for example), *por eso* (that's why), *por fin* (finally), *por lo menos* (at least).

        **Common fixed expressions with para:** *para siempre* (forever), *para colmo* (to top it off), *para nada* (not at all).

        **Memory aid:** Para points to a destination or purpose (forward-looking). Por explains the cause or path (backward-looking). Ask yourself: "Am I explaining *why* (por) or *what for* (para)?"
        """
    )

    // MARK: - 3. Preterite vs Imperfect

    private static let preteriteVsImperfect = GrammarNote(
        id: "preterite-vs-imperfect",
        title: "Preterite vs Imperfect",
        category: "Past Tenses",
        body: """
        Spanish uses two simple past tenses: the preterite (*pretérito indefinido*) for completed actions and the imperfect (*pretérito imperfecto*) for ongoing or habitual past actions.

        **Preterite** describes actions that started and ended at a specific point in the past — they are completed, one-time, or sequential events.

        *Ayer comí una pizza.* — Yesterday I ate a pizza.
        *Ella llegó a las ocho.* — She arrived at eight.
        *Ellos vivieron en París por dos años.* — They lived in Paris for two years (and then stopped).
        *Me levanté, me duché y salí de casa.* — I got up, showered, and left the house.

        **Imperfect** describes ongoing states, habitual actions, or background descriptions in the past — there is no defined endpoint.

        *Cuando era niño, jugaba en el parque.* — When I was a child, I used to play in the park.
        *Hacía sol y los pájaros cantaban.* — It was sunny and the birds were singing.
        *Siempre comíamos juntos los domingos.* — We always ate together on Sundays.
        *Ella tenía diez años cuando se mudó.* — She was ten years old when she moved.

        **The movie rule:** Think of a story as a movie. The imperfect sets the scene (background, descriptions, weather, feelings), while the preterite advances the plot (specific events that happen).

        *Llovía mucho (imperfect — background) cuando de repente sonó el teléfono (preterite — plot).* — It was raining a lot when suddenly the phone rang.
        *Yo dormía (imperfect — background) cuando alguien tocó la puerta (preterite — plot).* — I was sleeping when someone knocked on the door.

        **Key time markers:** Preterite: *ayer, anoche, una vez, de repente, el año pasado*. Imperfect: *siempre, todos los días, mientras, generalmente, de niño*.

        **Meaning changes:** Some verbs shift meaning between tenses. *Conocí a Juan* (I met Juan — first time). *Conocía a Juan* (I knew Juan — ongoing familiarity). *Supe la verdad* (I found out the truth). *Sabía la verdad* (I knew the truth).
        """
    )

    // MARK: - 4. Subjunctive Triggers

    private static let subjunctiveTriggers = GrammarNote(
        id: "subjunctive-triggers",
        title: "Subjunctive Triggers",
        category: "Subjunctive",
        body: """
        The subjunctive mood (*subjuntivo*) expresses wishes, doubts, emotions, and hypothetical situations. Use the acronym **WEIRDO** to remember the categories that trigger it.

        **W — Wishes and desires:** Verbs like *querer, desear, esperar, preferir*.
        *Quiero que vengas a la fiesta.* — I want you to come to the party.
        *Esperamos que todo salga bien.* — We hope everything goes well.

        **E — Emotions:** Verbs like *alegrarse de, temer, sentir, sorprender*.
        *Me alegra que estés aquí.* — I'm glad you are here.
        *Siento que no puedas venir.* — I'm sorry you can't come.

        **I — Impersonal expressions:** *Es importante que, es necesario que, es posible que*.
        *Es necesario que estudies más.* — It's necessary that you study more.
        *Es posible que llueva mañana.* — It's possible that it rains tomorrow.

        **R — Recommendations and requests:** Verbs like *recomendar, sugerir, pedir, aconsejar, exigir*.
        *Te recomiendo que pruebes la paella.* — I recommend that you try the paella.
        *El profesor pide que hagamos la tarea.* — The teacher asks that we do the homework.

        **D — Doubt and denial:** Verbs like *dudar, negar, no creer, no pensar*.
        *Dudo que él sepa la respuesta.* — I doubt he knows the answer.
        *No creo que sea verdad.* — I don't think it's true.

        **O — Ojalá:** This word (from Arabic, meaning "God willing") always triggers the subjunctive.
        *Ojalá que haga buen tiempo.* — I hope the weather is nice.
        *Ojalá pudiera viajar más.* — I wish I could travel more.

        **Important rule:** The subjunctive requires a change of subject. If the subject is the same, use the infinitive instead.
        *Quiero ir* (same subject — I want to go). *Quiero que tú vayas* (different subjects — I want you to go).

        **Common trigger phrases:** *antes de que* (before), *para que* (so that), *a menos que* (unless), *sin que* (without), *cuando* (when — future), *hasta que* (until).
        """
    )

    // MARK: - 5. Reflexive Verbs

    private static let reflexiveVerbs = GrammarNote(
        id: "reflexive-verbs",
        title: "Reflexive Verbs",
        category: "Verb Types",
        body: """
        Reflexive verbs (*verbos reflexivos*) indicate that the subject performs and receives the action — the action "reflects" back. They are identified by the pronoun *se* attached to the infinitive: *lavarse, vestirse, despertarse*.

        **Reflexive pronouns** match the subject: *me* (yo), *te* (tú), *se* (él/ella/usted), *nos* (nosotros), *os* (vosotros), *se* (ellos/ustedes).

        *Me despierto a las siete.* — I wake (myself) up at seven.
        *Te duchas todas las mañanas.* — You shower every morning.
        *Ella se viste rápidamente.* — She gets dressed quickly.
        *Nos acostamos tarde los sábados.* — We go to bed late on Saturdays.

        **Common reflexive verbs:** *levantarse* (to get up), *acostarse* (to go to bed), *sentarse* (to sit down), *llamarse* (to be called), *sentirse* (to feel), *preocuparse* (to worry), *quejarse* (to complain), *irse* (to leave), *ponerse* (to put on / to become), *divertirse* (to have fun).

        **Pronoun placement:** The pronoun goes before a conjugated verb, but attaches to the end of infinitives, gerunds, and affirmative commands.

        *Me lavo las manos.* — I wash my hands.
        *Voy a lavarme las manos.* — I'm going to wash my hands.
        *Estoy lavándome las manos.* — I'm washing my hands.
        *¡Lávate las manos!* — Wash your hands! (command)

        **Reflexive vs non-reflexive meaning changes:** Some verbs change meaning when used reflexively.

        *Dormir* — to sleep. *Dormirse* — to fall asleep.
        *Ir* — to go. *Irse* — to leave / go away.
        *Poner* — to put. *Ponerse* — to put on (clothing) / to become.
        *Llamar* — to call. *Llamarse* — to be called / named.
        *Parecer* — to seem. *Parecerse a* — to resemble.

        **Reciprocal use:** Plural reflexive forms can mean "each other."
        *Nos queremos mucho.* — We love each other a lot.
        *Se escriben todos los días.* — They write to each other every day.
        """
    )

    // MARK: - 6. Direct & Indirect Object Pronouns

    private static let objectPronouns = GrammarNote(
        id: "object-pronouns",
        title: "Direct & Indirect Object Pronouns",
        category: "Pronouns",
        body: """
        Object pronouns replace nouns to avoid repetition. Spanish distinguishes between direct objects (what receives the action) and indirect objects (who benefits from or is affected by the action).

        **Direct object pronouns (DOPs):** *me, te, lo/la, nos, os, los/las*. They replace the thing or person directly acted upon.

        *¿Tienes el libro? Sí, lo tengo.* — Do you have the book? Yes, I have it.
        *Compré las flores. Las compré ayer.* — I bought the flowers. I bought them yesterday.
        *No la conozco.* — I don't know her.

        **Indirect object pronouns (IOPs):** *me, te, le, nos, os, les*. They indicate to whom or for whom the action is done.

        *Le doy el regalo a María.* — I give the gift to María.
        *Nos escribió una carta.* — He wrote us a letter.
        *Te compré un café.* — I bought you a coffee.

        **Placement rules:** Object pronouns go before a conjugated verb, or attach to infinitives, gerunds, and affirmative commands.

        *Lo veo.* — I see it/him.
        *Voy a verlo.* / *Lo voy a ver.* — I'm going to see it/him.
        *Estoy leyéndolo.* / *Lo estoy leyendo.* — I'm reading it.
        *¡Dámelo!* — Give it to me!

        **Double object pronouns:** When both appear, the IOP comes first. When both are third person, *le/les* changes to *se*.

        *Se lo dije.* — I told it to him/her (not *le lo*).
        *¿El libro? Se lo presté a Juan.* — The book? I lent it to Juan.
        *Me las regaló.* — She gave them to me.

        **Common mistake — redundant le:** In Spanish, the indirect object pronoun often appears even when the noun is stated.
        *Le di el libro a María.* — I gave the book to María (the *le* is required even with *a María*).

        **Personal a:** When the direct object is a person, add *a* before them: *Veo a mi madre* → *La veo*. This *a* has no English translation.
        """
    )

    // MARK: - 7. Gustar-like Verbs

    private static let gustarLikeVerbs = GrammarNote(
        id: "gustar-like-verbs",
        title: "Gustar-like Verbs",
        category: "Verb Types",
        body: """
        *Gustar* and similar verbs work "backwards" compared to English. Instead of "I like pizza," Spanish says "Pizza is pleasing to me" — the thing liked is the grammatical subject.

        **Structure:** Indirect object pronoun + *gusta/gustan* + subject (the thing liked).

        *Me gusta el chocolate.* — I like chocolate (chocolate is pleasing to me).
        *Me gustan los perros.* — I like dogs (dogs are pleasing to me).
        *Te gusta bailar.* — You like to dance.
        *Nos gusta la música.* — We like music.
        *Les gustan las películas.* — They like movies.

        **Only two main forms:** Use *gusta* with singular nouns and infinitives. Use *gustan* with plural nouns.

        *Me gusta leer y escribir.* — I like to read and write (infinitives = gusta).
        *¿Te gustan estos zapatos?* — Do you like these shoes? (plural = gustan).

        **Clarifying with "a":** Since *le* and *les* can refer to multiple people, add *a + name/pronoun* for clarity.

        *A ella le gusta el café.* — She likes coffee.
        *A mis padres les encanta viajar.* — My parents love to travel.
        *A mí me gusta, pero a ti no te gusta.* — I like it, but you don't.

        **Other verbs that work like gustar:**

        *Encantar* — to love/delight: *Me encanta esta canción.* — I love this song.
        *Molestar* — to bother: *Le molesta el ruido.* — The noise bothers him.
        *Importar* — to matter: *No me importa el precio.* — The price doesn't matter to me.
        *Interesar* — to interest: *Nos interesan las ciencias.* — Sciences interest us.
        *Faltar* — to lack/be missing: *Me faltan dos páginas.* — I'm missing two pages.
        *Doler* — to hurt: *Me duele la cabeza.* — My head hurts.
        *Parecer* — to seem: *Me parece una buena idea.* — It seems like a good idea to me.
        *Quedar* — to remain/have left: *No nos queda tiempo.* — We don't have time left.
        *Fascinar* — to fascinate: *Les fascinan los dinosaurios.* — Dinosaurs fascinate them.
        """
    )

    // MARK: - 8. Comparatives & Superlatives

    private static let comparativesSuperlatives = GrammarNote(
        id: "comparatives-superlatives",
        title: "Comparatives & Superlatives",
        category: "Adjectives",
        body: """
        Comparatives and superlatives let you compare people, things, and actions. Spanish uses *más* (more), *menos* (less), and *tan* (as) instead of English suffixes like "-er" and "-est."

        **Comparatives of inequality:** *más/menos + adjective + que*

        *María es más alta que Juan.* — María is taller than Juan.
        *Este libro es menos interesante que el otro.* — This book is less interesting than the other one.
        *Ella corre más rápido que yo.* — She runs faster than me.
        *Tengo más amigos que tú.* — I have more friends than you.

        **Comparatives of equality:** *tan + adjective + como*

        *Pedro es tan inteligente como su hermana.* — Pedro is as smart as his sister.
        *Esta casa es tan grande como la tuya.* — This house is as big as yours.
        *No soy tan rápido como tú.* — I'm not as fast as you.

        For nouns, use *tanto/tanta/tantos/tantas + noun + como*:
        *Tengo tantos libros como ella.* — I have as many books as she does.
        *No hay tanta gente como ayer.* — There aren't as many people as yesterday.

        **Superlatives:** *el/la/los/las + más/menos + adjective + de*

        *Es la ciudad más bonita de España.* — It's the most beautiful city in Spain.
        *Él es el estudiante más trabajador de la clase.* — He is the hardest-working student in the class.
        *Es el restaurante menos caro del barrio.* — It's the least expensive restaurant in the neighborhood.

        **Absolute superlative:** Add *-ísimo/a* for "extremely" or "very."
        *La comida está riquísima.* — The food is extremely delicious.
        *Estoy cansadísimo.* — I am extremely tired.

        **Irregular forms — these do NOT use más:**

        *Bueno → mejor (better) → el mejor (the best)*
        *Malo → peor (worse) → el peor (the worst)*
        *Grande → mayor (older/greater) → el mayor (the oldest/greatest)*
        *Pequeño → menor (younger/lesser) → el menor (the youngest/least)*

        *Mi hermano mayor vive en Barcelona.* — My older brother lives in Barcelona.
        *Esta película es mejor que la anterior.* — This movie is better than the previous one.
        *Es el peor día de mi vida.* — It's the worst day of my life.
        """
    )

    // MARK: - 9. Conditional & "If" Clauses

    private static let conditionalIfClauses = GrammarNote(
        id: "conditional-if-clauses",
        title: "Conditional & \"If\" Clauses",
        category: "Verb Tenses",
        body: """
        Spanish conditional sentences (*oraciones condicionales*) follow specific patterns depending on how likely the condition is. There are three main types, each requiring a different verb tense combination.

        **Type 1 — Real / Possible conditions:** Use *si* + present indicative in the "if" clause, and the present or future tense in the result clause. These describe situations that are likely or possible.

        *Si llueve, me quedo en casa.* — If it rains, I stay home.
        *Si estudias mucho, aprobarás el examen.* — If you study a lot, you will pass the exam.
        *Si tienes tiempo, llámame.* — If you have time, call me.
        *Si no comes, vas a tener hambre.* — If you don't eat, you're going to be hungry.

        **Type 2 — Hypothetical / Unlikely conditions:** Use *si* + imperfect subjunctive in the "if" clause, and the conditional tense in the result clause. These describe situations that are unlikely, imaginary, or contrary to the present reality.

        *Si tuviera dinero, viajaría por el mundo.* — If I had money, I would travel the world.
        *Si yo fuera tú, no haría eso.* — If I were you, I wouldn't do that.
        *Si hablara español perfectamente, viviría en España.* — If I spoke Spanish perfectly, I would live in Spain.
        *Si pudiéramos volar, no necesitaríamos aviones.* — If we could fly, we wouldn't need airplanes.

        **Type 3 — Past unreal / Impossible conditions:** Use *si* + pluperfect subjunctive in the "if" clause, and the conditional perfect in the result clause. These describe situations that did not happen in the past.

        *Si hubiera estudiado, habría aprobado.* — If I had studied, I would have passed.
        *Si hubiéramos salido antes, habríamos llegado a tiempo.* — If we had left earlier, we would have arrived on time.
        *Si no hubiera llovido, habríamos ido a la playa.* — If it hadn't rained, we would have gone to the beach.

        **Key rule:** Never use the present subjunctive or the conditional after *si*. You will never say *si tendría* or *si tenga* — those are always incorrect.

        **Mixed conditionals:** Occasionally, you can mix Type 2 and Type 3 when the past condition affects the present: *Si hubiera desayunado, no tendría hambre ahora* — If I had eaten breakfast, I wouldn't be hungry now.
        """
    )

    // MARK: - 10. Commands (Imperative Mood)

    private static let commandsImperative = GrammarNote(
        id: "commands-imperative",
        title: "Commands (Imperative Mood)",
        category: "Verb Tenses",
        body: """
        The imperative mood (*el imperativo*) is used to give commands, instructions, or requests. Spanish has different command forms depending on who you are addressing and whether the command is affirmative or negative.

        **Affirmative tú commands** are usually the same as the third-person singular present indicative: *habla* (speak), *come* (eat), *escribe* (write).

        *Habla más despacio, por favor.* — Speak more slowly, please.
        *Come tus verduras.* — Eat your vegetables.
        *Abre la puerta.* — Open the door.

        **Eight irregular tú commands** must be memorized: *di* (decir), *haz* (hacer), *ve* (ir), *pon* (poner), *sal* (salir), *sé* (ser), *ten* (tener), *ven* (venir).

        *Haz tu tarea ahora.* — Do your homework now.
        *Ven aquí, por favor.* — Come here, please.
        *Pon la mesa antes de cenar.* — Set the table before dinner.
        *Di la verdad.* — Tell the truth.

        **Negative tú commands** use the present subjunctive form — they are different from affirmative commands.

        *No hables tan rápido.* — Don't speak so fast.
        *No comas eso.* — Don't eat that.
        *No vayas solo.* — Don't go alone.
        *No hagas ruido.* — Don't make noise.

        **Usted/Ustedes commands** use the present subjunctive for both affirmative and negative forms.

        *Hable con el gerente, por favor.* — Speak with the manager, please (usted).
        *No se preocupen.* — Don't worry (ustedes).

        **Pronoun attachment rules:** In affirmative commands, pronouns attach to the end of the verb. In negative commands, pronouns go before the verb.

        *Dímelo.* — Tell it to me.
        *No me lo digas.* — Don't tell it to me.
        *Siéntate aquí.* — Sit here.
        *No te sientes ahí.* — Don't sit there.
        *Cómpramelo.* — Buy it for me.
        *No me lo compres.* — Don't buy it for me.

        **Accent marks:** When attaching pronouns to an affirmative command, add an accent mark to preserve the original stress: *dime* → *dímelo*, *sienta* → *siéntate*.
        """
    )

    // MARK: - 11. Saber vs Conocer

    private static let saberVsConocer = GrammarNote(
        id: "saber-vs-conocer",
        title: "Saber vs Conocer",
        category: "Core Concepts",
        body: """
        Spanish has two verbs meaning "to know": *saber* and *conocer*. They are not interchangeable — each refers to a different type of knowledge.

        **Saber** is used for facts, information, and learned skills. It answers "Do you know this piece of information?" or "Do you know how to do this?"

        *Sé la respuesta.* — I know the answer.
        *¿Sabes dónde está el banco?* — Do you know where the bank is?
        *Ella sabe hablar tres idiomas.* — She knows how to speak three languages.
        *Sé nadar.* — I know how to swim.
        *No sabemos cuándo llega el tren.* — We don't know when the train arrives.

        **Conocer** is used for familiarity with people, places, and things. It implies personal experience or acquaintance rather than factual knowledge.

        *Conozco Madrid muy bien.* — I know Madrid very well.
        *¿Conoces a mi hermana?* — Do you know my sister?
        *Conocemos ese restaurante.* — We know (are familiar with) that restaurant.
        *No conozco esa canción.* — I don't know (am not familiar with) that song.
        *Ella conoce la obra de Picasso.* — She is familiar with Picasso's work.

        **Key difference:** *Saber* = information in your head. *Conocer* = personal experience or acquaintance. You can *saber* a fact, but you *conocer* a person.

        *Sé que Madrid es la capital de España.* — I know that Madrid is the capital of Spain (fact).
        *Conozco Madrid porque viví allí dos años.* — I know Madrid because I lived there for two years (familiarity).

        **Meaning changes in the preterite:** Both verbs shift meaning when used in the preterite tense, because the completed action implies a starting point.

        *Supe la verdad ayer.* — I found out the truth yesterday (completed act of learning).
        *Conocí a tu hermana ayer.* — I met your sister yesterday (first encounter).
        *Supimos que estaba enferma.* — We found out she was sick.
        *Conocieron la ciudad durante el viaje.* — They got to know the city during the trip.

        **Remember:** *Conocer* always takes the personal *a* before people: *Conozco a tu profesor* — I know your teacher. *Saber* never uses the personal *a*.
        """
    )

    // MARK: - 12. Double Negatives

    private static let doubleNegatives = GrammarNote(
        id: "double-negatives",
        title: "Double Negatives",
        category: "Sentence Structure",
        body: """
        Unlike English, where double negatives are considered incorrect, Spanish requires them. When a negative word follows the verb, *no* must appear before the verb as well. This is standard, correct Spanish grammar.

        **The core rule:** If the negative word comes after the verb, place *no* before the verb. If the negative word comes before the verb, do not add *no*.

        **No...nada** (nothing):
        *No quiero nada.* — I don't want anything / I want nothing.
        *Nada me sorprende.* — Nothing surprises me.

        **No...nunca / no...jamás** (never):
        *No como carne nunca.* — I never eat meat.
        *Nunca llueve en el desierto.* — It never rains in the desert.
        *No he ido jamás a Japón.* — I have never been to Japan.

        **No...nadie** (nobody):
        *No vi a nadie en la calle.* — I didn't see anyone on the street.
        *Nadie sabe la respuesta.* — Nobody knows the answer.
        *No le dijo a nadie.* — He didn't tell anyone.

        **No...ninguno/ningún/ninguna** (no, not any, none):
        *No tengo ningún problema.* — I don't have any problem.
        *Ninguna tienda está abierta.* — No store is open.
        *No queda ninguno.* — There are none left.

        **No...tampoco** (neither, not either):
        *No me gusta tampoco.* — I don't like it either.
        *Tampoco quiero ir.* — I don't want to go either.
        *Ella no fue y yo tampoco.* — She didn't go and I didn't either.

        **No...ni...ni** (neither...nor):
        *No tengo ni tiempo ni dinero.* — I have neither time nor money.
        *Ni come ni deja comer.* — He neither eats nor lets others eat (proverb).
        *No quiero ni café ni té.* — I want neither coffee nor tea.

        **Multiple negatives in one sentence** are perfectly natural in Spanish:
        *No le dije nada a nadie nunca.* — I never said anything to anyone.
        *Nadie sabe nada de ningún problema.* — Nobody knows anything about any problem.

        **Common mistake for English speakers:** Saying *No quiero algo* (incorrect) instead of *No quiero nada* (correct). After *no*, always use the negative counterpart: *algo* → *nada*, *alguien* → *nadie*, *alguno* → *ninguno*, *siempre* → *nunca*, *también* → *tampoco*.
        """
    )

    // MARK: - 13. Adjective Placement

    private static let adjectivePlacement = GrammarNote(
        id: "adjective-placement",
        title: "Adjective Placement",
        category: "Sentence Structure",
        body: """
        In English, adjectives almost always come before the noun. In Spanish, the default position is after the noun, but placing an adjective before the noun adds a subjective, emotional, or emphatic quality. Some adjectives even change meaning depending on their position.

        **Default position — after the noun:** Most adjectives follow the noun and provide objective, distinguishing information.

        *Un coche rojo.* — A red car.
        *Una casa grande.* — A big house.
        *Un hombre inteligente.* — An intelligent man.
        *Quiero agua fría.* — I want cold water.
        *Es una decisión importante.* — It's an important decision.

        **Before the noun — subjective or emotional quality:** Placing the adjective before the noun emphasizes a quality the speaker considers inherent or expresses a personal judgment.

        *Una hermosa ciudad.* — A beautiful city (admiration).
        *Un gran hombre.* — A great man (character).
        *Los pequeños detalles importan.* — The little details matter (emphasis).

        **Adjectives that change meaning by position:** This is one of the trickiest areas of Spanish grammar.

        *Pobre:* *El pobre hombre* — The unfortunate man. *El hombre pobre* — The man who has no money.
        *Viejo:* *Un viejo amigo* — A longstanding friend. *Un amigo viejo* — An elderly friend.
        *Nuevo:* *Un nuevo coche* — A different car (new to the owner). *Un coche nuevo* — A brand-new car.
        *Mismo:* *El mismo problema* — The same problem. *El problema mismo* — The problem itself.
        *Grande:* *Una gran mujer* — A great woman. *Una mujer grande* — A large/big woman.
        *Único:* *La única oportunidad* — The only opportunity. *Una oportunidad única* — A unique opportunity.

        **Shortened forms before masculine singular nouns:** Some adjectives lose their final -o when placed before a masculine singular noun.

        *Bueno → buen:* *Es un buen libro.* — It's a good book.
        *Malo → mal:* *Hace mal tiempo.* — The weather is bad.
        *Grande → gran:* *Es un gran momento.* — It's a great moment (works for both genders).
        *Primero → primer:* *El primer día de clase.* — The first day of class.
        *Tercero → tercer:* *El tercer piso.* — The third floor.

        **Adjectives that always go before the noun:** Quantifiers and numbers: *mucho, poco, otro, cada, ambos, varios*. *Hay muchas personas aquí.* — There are many people here. *Quiero otra oportunidad.* — I want another chance.
        """
    )

    // MARK: - 14. Tener Expressions

    private static let tenerExpressions = GrammarNote(
        id: "tener-expressions",
        title: "Tener Expressions",
        category: "Core Concepts",
        body: """
        One of the most common traps for English speakers is translating "I am hungry" or "I am 25 years old" directly. Spanish uses *tener* (to have) where English uses "to be" for many physical states and conditions. You literally "have hunger" rather than "are hungry."

        **Age:** *Tener + number + años*
        *Tengo veinticinco años.* — I am twenty-five years old.
        *¿Cuántos años tienes?* — How old are you?
        *Mi abuela tiene ochenta y dos años.* — My grandmother is eighty-two years old.

        **Physical sensations:**
        *Tener hambre* — to be hungry: *Tengo mucha hambre.* — I am very hungry.
        *Tener sed* — to be thirsty: *¿Tienes sed? Hay agua en la nevera.* — Are you thirsty? There's water in the fridge.
        *Tener calor* — to be hot: *Tenemos calor porque no hay aire acondicionado.* — We are hot because there's no air conditioning.
        *Tener frío* — to be cold: *¿Tienes frío? Te presto mi chaqueta.* — Are you cold? I'll lend you my jacket.
        *Tener sueño* — to be sleepy: *Los niños tienen sueño después de jugar.* — The kids are sleepy after playing.

        **Emotional states and situations:**
        *Tener miedo* — to be afraid: *Ella tiene miedo de las arañas.* — She is afraid of spiders.
        *Tener razón* — to be right: *Tienes razón, es mejor esperar.* — You're right, it's better to wait.
        *Tener suerte* — to be lucky: *Tuvimos mucha suerte con el clima.* — We were very lucky with the weather.
        *Tener prisa* — to be in a hurry: *Tengo prisa, hablamos luego.* — I'm in a hurry, we'll talk later.
        *Tener cuidado* — to be careful: *Ten cuidado con el hielo.* — Be careful with the ice.

        **Other important tener expressions:**
        *Tener ganas de* — to feel like: *Tengo ganas de bailar.* — I feel like dancing.
        *Tener que + infinitive* — to have to: *Tenemos que irnos ya.* — We have to leave now.
        *Tener la culpa* — to be at fault: *No tengo la culpa de nada.* — It's not my fault.
        *Tener sentido* — to make sense: *Eso no tiene sentido.* — That doesn't make sense.
        *Tener éxito* — to be successful: *La película tuvo mucho éxito.* — The movie was very successful.

        **Important:** Because these are nouns, use *mucho/mucha* (not *muy*) to intensify them: *Tengo mucha hambre* (correct), not *Tengo muy hambre* (incorrect).
        """
    )

    // MARK: - 15. The Personal "A"

    private static let personalA = GrammarNote(
        id: "personal-a",
        title: "The Personal \"A\"",
        category: "Sentence Structure",
        body: """
        Spanish requires the preposition *a* before direct objects that are specific people. This is called the "personal a" (*a personal*). It has no English translation — it simply signals that a person is the direct object of the verb.

        **Basic rule:** When the direct object is a specific, known person, place *a* before them.

        *Veo a María.* — I see María.
        *Llamo a mi madre todos los días.* — I call my mother every day.
        *Conozco a tu profesor.* — I know your teacher.
        *Extraño a mis amigos.* — I miss my friends.
        *Invité a Juan y a Sofía a la fiesta.* — I invited Juan and Sofía to the party.

        **Without personal a — non-human direct objects:** When the direct object is a thing, no *a* is needed.

        *Veo la mesa.* — I see the table.
        *Busco mis llaves.* — I'm looking for my keys.
        *Leo un libro.* — I'm reading a book.
        *Compré una casa.* — I bought a house.

        **Pets and personified things:** The personal *a* extends to beloved pets and things treated as people.

        *Llevo a mi perro al veterinario.* — I take my dog to the vet.
        *Los niños quieren a su gato.* — The kids love their cat.

        **NOT used after tener:** This is one of the most important exceptions. *Tener* does not take the personal *a*, even when referring to people.

        *Tengo dos hermanos.* — I have two siblings (no *a*).
        *Tiene tres hijos.* — She has three children (no *a*).
        *Tenemos un nuevo vecino.* — We have a new neighbor (no *a*).

        **NOT used with indefinite or non-specific people:** When you refer to an unspecified person, omit the personal *a*.

        *Busco un doctor.* — I'm looking for a doctor (any doctor, non-specific).
        *Busco a un doctor.* — I'm looking for a (specific) doctor (I know which one).
        *Necesito un traductor.* — I need a translator (any translator).
        *Necesito a mi traductor.* — I need my translator (specific person).

        **With nadie, alguien, and quién:** The personal *a* is used with these indefinite pronouns referring to people.

        *No veo a nadie.* — I don't see anyone.
        *¿Conoces a alguien aquí?* — Do you know anyone here?
        *¿A quién llamaste?* — Whom did you call?

        **Memory aid:** If the direct object can be replaced by a person's name, it probably needs the personal *a*. "I see ___" → if you could fill in "María," then use *a*.
        """
    )

    // MARK: - 16. Relative Pronouns

    private static let relativePronouns = GrammarNote(
        id: "relative-pronouns",
        title: "Relative Pronouns",
        category: "Sentence Structure",
        body: """
        Relative pronouns connect a subordinate clause to a main clause, providing additional information about a noun. Spanish has several relative pronouns, each with specific uses.

        **Que** — the most common relative pronoun, meaning "that," "which," or "who." It can refer to people or things and is used in both restrictive and non-restrictive clauses.

        *La chica que vive aquí es mi amiga.* — The girl who lives here is my friend.
        *El libro que compré es muy bueno.* — The book that I bought is very good.
        *La película que vimos anoche fue aburrida.* — The movie that we saw last night was boring.
        *Los estudiantes que estudian aprueban.* — Students who study pass.

        **Quien / Quienes** — used for people only, especially after prepositions. *Quien* is singular, *quienes* is plural.

        *La persona con quien hablé es la directora.* — The person with whom I spoke is the director.
        *Los amigos a quienes invité no vinieron.* — The friends whom I invited didn't come.
        *Quien mucho abarca, poco aprieta.* — He who grasps at too much holds little (proverb).
        *Fue mi madre quien me lo dijo.* — It was my mother who told me.

        **Lo que** — means "what" or "that which." It refers to abstract ideas, actions, or entire concepts rather than specific nouns.

        *No entiendo lo que dices.* — I don't understand what you're saying.
        *Lo que necesitas es descansar.* — What you need is to rest.
        *Haz lo que quieras.* — Do what you want.
        *Lo que pasó ayer fue increíble.* — What happened yesterday was incredible.

        **El cual / La cual / Los cuales / Las cuales** — more formal alternatives to *que*, typically used after prepositions, especially compound prepositions. They agree in gender and number with their antecedent.

        *La casa en la cual nací ya no existe.* — The house in which I was born no longer exists.
        *Los problemas por los cuales renunció eran graves.* — The problems for which he resigned were serious.
        *La razón por la cual te llamé es importante.* — The reason for which I called you is important.

        **Cuyo / Cuya / Cuyos / Cuyas** — means "whose." It agrees in gender and number with the thing possessed, not the possessor.

        *El hombre cuya hija conoces es mi vecino.* — The man whose daughter you know is my neighbor.
        *La autora cuyos libros he leído viene mañana.* — The author whose books I've read is coming tomorrow.
        *El país cuyo idioma estudio es España.* — The country whose language I study is Spain.

        **Donde** — means "where" and is used for places. It can be replaced by *en que* or *en el cual*.

        *La ciudad donde nací es pequeña.* — The city where I was born is small.
        *El restaurante donde comimos estaba lleno.* — The restaurant where we ate was full.
        """
    )

    // MARK: - 17. Future vs "Ir a + Infinitive"

    private static let futureVsIrA = GrammarNote(
        id: "future-vs-ir-a",
        title: "Future vs \"Ir a + Infinitive\"",
        category: "Verb Tenses",
        body: """
        Spanish has two main ways to express future actions: the simple future tense (*futuro simple*) and the construction *ir a + infinitive*. While both refer to the future, they carry different nuances and are used in different contexts.

        **Ir a + infinitive** — the informal, conversational future. It expresses plans, intentions, and actions about to happen. This is the most common way to talk about the future in everyday speech.

        *Voy a comer con mis amigos.* — I'm going to eat with my friends.
        *¿Qué vas a hacer este fin de semana?* — What are you going to do this weekend?
        *Ella va a estudiar medicina.* — She's going to study medicine.
        *Vamos a llegar tarde si no nos apuramos.* — We're going to be late if we don't hurry.
        *Van a construir un nuevo hospital aquí.* — They're going to build a new hospital here.

        **Simple future tense** — more formal, used for predictions, promises, firm resolutions, and probability. It is formed by adding endings (-é, -ás, -á, -emos, -éis, -án) to the infinitive.

        *Mañana lloverá todo el día.* — Tomorrow it will rain all day (prediction).
        *Te prometo que vendré temprano.* — I promise I will come early (promise).
        *Algún día hablaré español con fluidez.* — Someday I will speak Spanish fluently (resolution).
        *Estudiaré mucho para el examen final.* — I will study a lot for the final exam.

        **Future of probability** — a unique use of the simple future to express conjecture or wonder about the present. This has no equivalent in English grammar.

        *¿Qué hora será?* — I wonder what time it is (lit. "what time will it be?").
        *¿Dónde estará mi teléfono?* — Where could my phone be?
        *Costará unos cincuenta euros.* — It probably costs around fifty euros.
        *Tendrá unos treinta años.* — He must be around thirty years old.
        *Será verdad, pero no me lo creo.* — It may be true, but I don't believe it.

        **When to use which:** In conversation, *ir a + infinitive* is much more common than the simple future. Think of it like English: "I'm going to call you" (casual) vs "I shall contact you" (formal). The simple future sounds slightly more distant or formal in everyday speech.

        *Voy a llamarte luego.* — I'm going to call you later (casual, planned).
        *Te llamaré cuando llegue.* — I will call you when I arrive (more formal or uncertain).

        **Irregular future stems** (used with both future and conditional): *tener → tendr-, salir → saldr-, venir → vendr-, poner → pondr-, poder → podr-, saber → sabr-, hacer → har-, decir → dir-, querer → querr-, haber → habr-*.
        """
    )

    // MARK: - 18. Accent Marks & Stress Rules

    private static let accentMarksStress = GrammarNote(
        id: "accent-marks-stress",
        title: "Accent Marks & Stress Rules",
        category: "Pronunciation",
        body: """
        Spanish pronunciation follows predictable stress rules. Once you learn these patterns, you can correctly pronounce any word — and the written accent mark (*tilde*) tells you when a word breaks the pattern.

        **Rule 1 — Words ending in a vowel, -n, or -s:** The stress falls on the second-to-last syllable. These are called *palabras llanas* (or *graves*).

        *hablo* — HAB-lo (I speak)
        *comen* — CO-men (they eat)
        *zapatos* — za-PA-tos (shoes)
        *examen* — e-XA-men (exam)
        *joven* — JO-ven (young)

        **Rule 2 — Words ending in a consonant (other than -n or -s):** The stress falls on the last syllable. These are called *palabras agudas*.

        *hablar* — hab-LAR (to speak)
        *ciudad* — ciu-DAD (city)
        *español* — es-pa-ÑOL (Spanish)
        *reloj* — re-LOJ (clock)
        *pared* — pa-RED (wall)

        **Rule 3 — The accent mark overrides the default:** When a word does not follow the default pattern, an accent mark shows where the stress actually falls.

        *café* — ca-FÉ (coffee — ends in vowel but stress is on the last syllable)
        *teléfono* — te-LÉ-fo-no (telephone — stress on third-to-last syllable)
        *médico* — MÉ-di-co (doctor — stress on third-to-last syllable)
        *canción* — can-CIÓN (song — ends in -n but stress is on last syllable)
        *difícil* — di-FÍ-cil (difficult — ends in consonant but stress is on second-to-last)

        **Accent marks that distinguish meaning:** Some one-syllable words use accents to differentiate between two meanings. These are called *tildes diacríticas*.

        *si* (if) / *sí* (yes): *Si dices que sí, vamos.* — If you say yes, let's go.
        *el* (the) / *él* (he): *Él tiene el libro.* — He has the book.
        *tu* (your) / *tú* (you): *Tú tienes tu mochila.* — You have your backpack.
        *se* (reflexive pronoun) / *sé* (I know / be): *Yo sé que se fue.* — I know he left.
        *de* (of/from) / *dé* (give - subjunctive): *Quiero que me dé un poco de café.* — I want him to give me some coffee.
        *mas* (but - literary) / *más* (more): *Quiero más, mas no puedo.* — I want more, but I can't.

        **Question words always have accents:** *qué* (what), *cómo* (how), *dónde* (where), *cuándo* (when), *cuál* (which), *quién* (who), *cuánto* (how much). Compare: *Sé cuando llega* (I know when he arrives) vs *¿Cuándo llega?* (When does he arrive?).
        """
    )

    // MARK: - 19. "Se" Constructions

    private static let seConstructions = GrammarNote(
        id: "se-constructions",
        title: "\"Se\" Constructions",
        category: "Advanced",
        body: """
        The word *se* is one of the most versatile and confusing words in Spanish. It appears in at least five distinct grammatical constructions, each with different meaning and usage. Understanding these patterns is essential for intermediate and advanced learners.

        **1. Reflexive se — the subject acts on itself.** The action reflects back to the subject. The verb is conjugated with reflexive pronouns (*me, te, se, nos, os, se*).

        *Ella se lava las manos.* — She washes her hands (herself).
        *Me levanto a las siete.* — I get up at seven.
        *Se vistieron rápidamente.* — They got dressed quickly.
        *El gato se lame las patas.* — The cat licks its paws.

        **2. Reciprocal se — subjects act on each other.** Used with plural subjects to express mutual action.

        *Se aman mucho.* — They love each other a lot.
        *Nos vemos todos los viernes.* — We see each other every Friday.
        *Se escriben cartas largas.* — They write long letters to each other.
        *Se abrazaron al despedirse.* — They hugged each other when saying goodbye.

        **3. Impersonal se — no specific subject.** Used to make general statements about what "people" or "one" does. The verb is always third-person singular.

        *Se habla español aquí.* — Spanish is spoken here / One speaks Spanish here.
        *Se dice que va a llover.* — They say it's going to rain.
        *¿Cómo se dice esto en español?* — How do you say this in Spanish?
        *En España se cena muy tarde.* — In Spain, people eat dinner very late.
        *Se vive bien en esta ciudad.* — One lives well in this city.

        **4. Passive se — the subject receives the action.** Similar to English passive voice, but the verb agrees with the grammatical subject (the thing acted upon).

        *Se venden casas.* — Houses are sold / Houses for sale.
        *Se necesitan profesores.* — Teachers are needed.
        *Se abrió una nueva tienda.* — A new store was opened.
        *Aquí se reparan computadoras.* — Computers are repaired here.
        *Se hablan varios idiomas en Suiza.* — Several languages are spoken in Switzerland.

        **5. Accidental se — unplanned events.** This construction expresses that something happened accidentally or unintentionally. The structure is: *se + indirect object pronoun + verb + subject*.

        *Se me cayó el vaso.* — I dropped the glass (accidentally).
        *Se le olvidaron las llaves.* — He forgot the keys (they slipped his mind).
        *Se nos rompió la ventana.* — The window broke on us (by accident).
        *Se te perdió el teléfono.* — You lost your phone (unintentionally).
        *Se me acabó la paciencia.* — I ran out of patience.

        **How to tell them apart:** Look at the subject, the number of the verb, and whether the action is intentional. Context is key — the same sentence can have different meanings: *Se lavan* could mean "they wash themselves" (reflexive) or "they wash each other" (reciprocal).
        """
    )

    // MARK: - 20. Estar + Gerund (Progressive Tenses)

    private static let estarGerundProgressive = GrammarNote(
        id: "estar-gerund-progressive",
        title: "Estar + Gerund (Progressive Tenses)",
        category: "Verb Tenses",
        body: """
        The progressive tenses in Spanish are formed with *estar* + the gerund (*gerundio*). They emphasize that an action is in progress at a specific moment, much like English "-ing" forms, but with important differences in usage.

        **Present progressive:** *Estar* (present) + gerund. Describes what is happening right now.

        *Estoy hablando por teléfono.* — I am speaking on the phone.
        *¿Qué estás haciendo?* — What are you doing?
        *Ella está estudiando para el examen.* — She is studying for the exam.
        *Estamos esperando el autobús.* — We are waiting for the bus.
        *Los niños están jugando en el parque.* — The kids are playing in the park.

        **Gerund formation — regular verbs:**
        -ar verbs → *-ando*: hablar → *hablando*, estudiar → *estudiando*, caminar → *caminando*
        -er verbs → *-iendo*: comer → *comiendo*, beber → *bebiendo*, aprender → *aprendiendo*
        -ir verbs → *-iendo*: vivir → *viviendo*, escribir → *escribiendo*, abrir → *abriendo*

        **Irregular gerunds** — some common verbs have stem changes or spelling adjustments:

        *Decir → diciendo* (saying). *Dormir → durmiendo* (sleeping). *Leer → leyendo* (reading). *Ir → yendo* (going). *Pedir → pidiendo* (asking). *Seguir → siguiendo* (following). *Morir → muriendo* (dying). *Poder → pudiendo* (being able). *Venir → viniendo* (coming). *Oír → oyendo* (hearing).

        **Past progressive:** *Estar* (imperfect) + gerund. Describes what was in progress at a past moment.

        *Estaba leyendo cuando llegaste.* — I was reading when you arrived.
        *Estábamos cenando a las nueve.* — We were having dinner at nine.
        *¿Qué estabas haciendo anoche?* — What were you doing last night?

        **Key difference from English — NOT used for future plans:** In English, "I'm leaving tomorrow" uses the progressive for a future plan. In Spanish, you cannot do this. Use the present tense or *ir a + infinitive* instead.

        *Me voy mañana.* — I'm leaving tomorrow (correct — present tense).
        *Voy a salir mañana.* — I'm going to leave tomorrow (correct — ir a).
        *Estoy yendo mañana.* — (INCORRECT — do not use progressive for future plans).

        **Pronoun placement:** Pronouns can either attach to the gerund or go before *estar*. Both positions are correct.

        *Estoy haciéndolo.* / *Lo estoy haciendo.* — I am doing it.
        *Está diciéndomelo.* / *Me lo está diciendo.* — He is telling it to me.
        *Estamos buscándola.* / *La estamos buscando.* — We are looking for her.

        **Other verbs with gerunds:** While *estar* is the most common, other verbs can also combine with gerunds: *seguir* (to keep on), *continuar* (to continue), *andar* (to go around), *llevar* (duration). *Sigo estudiando español.* — I keep on studying Spanish. *Llevo tres años viviendo aquí.* — I've been living here for three years.
        """
    )
}
