import type { Puja, PujaMantra } from './types.js'
import { STANDARD_CLOSING_ARC, STANDARD_PRE_ARC, STANDARD_UPACHARAS } from './upacharas.js'

// The widely-attested Ganesha invocation shloka, recited at the opening
// meditation. Devanagari is the standard form found across puja paddhati; the
// IAST is a provisional transliteration pending a human reviewer.
const GANESH_DHYANA: PujaMantra = {
  jaapSlug: null,
  devanagari:
    'वक्रतुण्ड महाकाय सूर्यकोटिसमप्रभ ।\nनिर्विघ्नं कुरु मे देव सर्वकार्येषु सर्वदा ॥',
  iast:
    'vakratuṇḍa mahākāya sūryakoṭi-samaprabha |\nnirvighnaṃ kuru me deva sarvakāryeṣu sarvadā ||',
  meaning: {
    en: 'O curved-trunked and mighty-bodied one, radiant as a million suns — make all my undertakings free of obstacles, always, O Lord.',
    hi: 'हे वक्रतुण्ड, महाकाय, करोड़ों सूर्यों के समान तेजवाले देव — मेरे समस्त कार्यों को सदा निर्विघ्न कीजिए।',
  },
}

// The japa mantra of Ganapati, recited during the flower-archana. Text
// matches the `om-gan-ganapataye-namah` preset hand-verified in this
// package's `mantras/` module; `reviewPending` stays `true`.
const GANESH_JAPA: PujaMantra = {
  jaapSlug: 'om-gan-ganapataye-namah',
  devanagari: 'ॐ गं गणपतये नमः',
  iast: 'oṃ gaṃ gaṇapataye namaḥ',
  meaning: {
    en: 'Om — with the seed-syllable gam, salutations to Ganapati.',
    hi: 'ॐ — गं बीज सहित, गणपति को नमस्कार।',
  },
}

const ganesh: Puja = {
  slug: 'ganesh',
  name: { en: 'Ganesh Chaturthi Puja', hi: 'गणेश चतुर्थी पूजा' },
  kicker: {
    en: 'BHADRAPADA SHUKLA CHATURTHI · MIDDAY MUHURAT',
    hi: 'भाद्रपद शुक्ल चतुर्थी · मध्याह्न मुहूर्त',
  },
  whenWhy: {
    en: 'The worship of Ganesha — the remover of obstacles and the god of new beginnings and wisdom — on Ganesh Chaturthi, the fourth tithi of the bright fortnight of Bhadrapada (which falls between late August and mid-September). The midday (madhyahna) period is held the most auspicious for the puja, since Ganesha is said to have been born then. A new clay murti is installed with Prana Pratishtha, worshipped daily — domestic observances run for 1½, 3, 5, 7, or 11 days — and then carried in procession for visarjana, immersion in water, traditionally on Anant Chaturdashi. The same shodashopachara worship is also offered to Ganesha at the start of any other puja or new venture.',
    hi: 'गणेश चतुर्थी — भाद्रपद के शुक्ल पक्ष की चतुर्थी (जो अगस्त के अन्त से सितंबर के मध्य के बीच पड़ती है) — को विघ्नहर्ता, नवारम्भ एवं बुद्धि के देव गणेश का पूजन। मध्याह्न का समय पूजा के लिए सर्वश्रेष्ठ माना जाता है, क्योंकि गणेश जी का प्राकट्य उसी काल में हुआ माना जाता है। एक नई मिट्टी की मूर्ति की प्राण-प्रतिष्ठा कर प्रतिदिन पूजन किया जाता है — गृह-अनुष्ठान डेढ़, तीन, पाँच, सात अथवा ग्यारह दिन तक चलते हैं — एवं तत्पश्चात् शोभायात्रा सहित विसर्जन, परम्परानुसार अनन्त चतुर्दशी को। यही षोडशोपचार पूजन किसी भी अन्य पूजा अथवा नये कार्य के आरम्भ में भी गणेश को अर्पित किया जाता है।',
  },
  rosterDeity: 'ganesha',
  samagri: [
    {
      group: { en: 'Murti & seat', hi: 'मूर्ति एवं आसन' },
      label: {
        en: 'A clay murti of Ganesha, a chowki, and a red or yellow cloth to spread over it',
        hi: 'गणेश जी की मिट्टी की मूर्ति, एक चौकी, एवं उस पर बिछाने हेतु लाल अथवा पीला वस्त्र',
      },
    },
    {
      group: { en: 'Kalash', hi: 'कलश' },
      label: {
        en: 'A kalash with water, mango leaves, and a coconut; raw rice; kalawa',
        hi: 'जल भरा कलश, आम के पत्ते एवं नारियल; कच्चे चावल; कलावा',
      },
    },
    {
      group: { en: 'Signature offerings', hi: 'विशेष अर्पण' },
      label: {
        en: 'Durva grass (offered in sprigs, customarily twenty-one) and red flowers, especially red hibiscus',
        hi: 'दूर्वा (सामान्यतः इक्कीस दलों में अर्पित) एवं लाल पुष्प, विशेषकर लाल जपाकुसुम (गुड़हल)',
      },
    },
    {
      group: { en: 'Offerings', hi: 'अर्पण-सामग्री' },
      label: {
        en: 'Akshat, roli, kumkum, sandalwood, sindoor, a sacred thread, and a fresh cloth',
        hi: 'अक्षत, रोली, कुमकुम, चन्दन, सिन्दूर, यज्ञोपवीत एवं नवीन वस्त्र',
      },
    },
    {
      group: { en: 'Naivedya', hi: 'नैवेद्य' },
      label: {
        en: 'Modak (held to be Ganesha\'s favourite, customarily twenty-one), laddu, and seasonal fruit',
        hi: 'मोदक (गणेश जी का प्रिय भोग, सामान्यतः इक्कीस), लड्डू एवं ऋतु-फल',
      },
    },
    {
      group: { en: 'Panchamrita', hi: 'पंचामृत' },
      label: {
        en: 'Milk, curd, ghee, honey, and sugar for the abhishek; clean water',
        hi: 'अभिषेक हेतु दूध, दही, घी, शहद एवं शक्कर; स्वच्छ जल',
      },
    },
    {
      group: { en: 'Lamps & incense', hi: 'दीप एवं धूप' },
      label: {
        en: 'A ghee lamp, dhoop or agarbatti, camphor, and betel leaves with areca nut',
        hi: 'घी का दीपक, धूप अथवा अगरबत्ती, कपूर, एवं पान-सुपारी',
      },
    },
  ],
  sankalpa: {
    en: 'I, [gotra and name], at [place], on this Ganesh Chaturthi, with my family, resolve to install and worship Shri Ganesha with devotion, for the removal of all obstacles and for the success of [intention].',
    hi: 'मैं, [गोत्र एवं नाम], [स्थान] पर, इस गणेश चतुर्थी को, अपने परिवार सहित, श्री गणेश की स्थापना एवं पूजन श्रद्धापूर्वक करने का संकल्प करता/करती हूँ — समस्त विघ्नों के निवारण एवं [अभिप्राय] की सिद्धि हेतु।',
  },
  preUpacharas: [
    ...STANDARD_PRE_ARC,
    {
      slug: 'prana-pratishtha',
      name: {
        sanskrit: 'प्राण-प्रतिष्ठा',
        en: 'Prana Pratishtha',
        hi: 'प्राण-प्रतिष्ठा',
      },
      line: {
        en: 'Install the murti on the chowki and perform Prana Pratishtha — invoking the living presence of Ganesha into the new image, touching its heart and eyes with akshat and a flower while the invocation is recited.',
        hi: 'मूर्ति को चौकी पर स्थापित कर प्राण-प्रतिष्ठा करें — नई मूर्ति में गणेश जी की सजीव उपस्थिति का आवाहन; आवाहन-मन्त्र के साथ अक्षत एवं पुष्प से मूर्ति के हृदय एवं नेत्रों का स्पर्श करें।',
      },
      conditional: {
        en: 'Prana Pratishtha is performed when a new clay or metal murti is being installed; for a permanent home-shrine image, a brief re-invocation each day is enough.',
        hi: 'प्राण-प्रतिष्ठा तब की जाती है जब नई मिट्टी अथवा धातु की मूर्ति स्थापित की जा रही हो; स्थायी गृह-मन्दिर की मूर्ति के लिए प्रतिदिन संक्षिप्त पुनः-आवाहन पर्याप्त है।',
      },
    },
  ],
  upacharas: [
    {
      ...STANDARD_UPACHARAS[0],
      line: {
        en: 'Meditate on Ganesha — elephant-headed, large-bodied, holding the noose, the goad, and a bowl of modak — and recite the invocation shloka before inviting his presence into the murti.',
        hi: 'गणेश जी का ध्यान करें — गजमुख, महाकाय, पाश, अंकुश एवं मोदक-पात्र धारण किए — एवं मूर्ति में उनकी उपस्थिति के आवाहन से पूर्व आवाहन-श्लोक का पाठ करें।',
      },
      mantra: GANESH_DHYANA,
    },
    ...STANDARD_UPACHARAS.slice(1, 6),
    {
      ...STANDARD_UPACHARAS[6],
      line: {
        en: 'Bathe the murti with panchamrita — milk, curd, ghee, honey, and sugar — and then with clean water. A clay murti meant for immersion is bathed only lightly, with a sprinkle.',
        hi: 'मूर्ति को पंचामृत — दूध, दही, घी, शहद एवं शक्कर — से, फिर स्वच्छ जल से स्नान कराएँ। विसर्जन हेतु बनी मिट्टी की मूर्ति को केवल हल्के छिड़काव से स्नान कराया जाता है।',
      },
    },
    ...STANDARD_UPACHARAS.slice(7, 10),
    {
      ...STANDARD_UPACHARAS[10],
      line: {
        en: 'Offer red flowers — especially red hibiscus — and durva grass, customarily in sprigs of twenty-one, one at a time, while reciting the name-mantra of Ganapati. Durva is the offering most particular to Ganesha.',
        hi: 'लाल पुष्प — विशेषकर लाल जपाकुसुम — एवं दूर्वा, सामान्यतः इक्कीस दलों में, एक-एक करके अर्पित करें तथा गणपति का नाम-मन्त्र जपें। दूर्वा गणेश जी को सर्वाधिक प्रिय अर्पण है।',
      },
      mantra: GANESH_JAPA,
    },
    ...STANDARD_UPACHARAS.slice(11, 13),
    {
      ...STANDARD_UPACHARAS[13],
      line: {
        en: 'Offer modak — held to be Ganesha\'s favourite, customarily twenty-one — with laddu and seasonal fruit, placed on a clean dish.',
        hi: 'मोदक — गणेश जी का प्रिय भोग, सामान्यतः इक्कीस — लड्डू एवं ऋतु-फल सहित स्वच्छ थाली में अर्पित करें।',
      },
    },
    ...STANDARD_UPACHARAS.slice(14),
  ],
  postUpacharas: [
    ...STANDARD_CLOSING_ARC,
    {
      slug: 'visarjana',
      name: { sanskrit: 'विसर्जन', en: 'Visarjana', hi: 'विसर्जन' },
      line: {
        en: 'At the end of the observance, the murti is carried in procession and immersed in water (visarjana), with a prayer asking Ganesha to return the following year. The akshat and flowers of the daily worship are immersed with it.',
        hi: 'अनुष्ठान के अन्त में मूर्ति को शोभायात्रा सहित जल में विसर्जित किया जाता है, इस प्रार्थना के साथ कि गणेश जी अगले वर्ष पुनः पधारें। दैनिक पूजन के अक्षत एवं पुष्प भी उसी के साथ विसर्जित किए जाते हैं।',
      },
      conditional: {
        en: 'Visarjana is done on the chosen final day — for many households on Anant Chaturdashi, the tenth day after Chaturthi. A permanent home-shrine image is not immersed.',
        hi: 'विसर्जन चुने हुए अन्तिम दिन किया जाता है — अनेक परिवारों में अनन्त चतुर्दशी को, चतुर्थी के दसवें दिन। स्थायी गृह-मन्दिर की मूर्ति का विसर्जन नहीं किया जाता।',
      },
    },
  ],
  stotraKathaRef: {
    kind: 'aarti',
    deity: 'ganesha',
    label: { en: 'Ganesh Aarti', hi: 'गणेश आरती' },
    note: {
      en: 'The Ganesh aarti is sung at the close of each day\'s worship, before the prasad is shared. It is available as an aarti in this package.',
      hi: 'प्रत्येक दिन के पूजन के समापन पर, प्रसाद वितरण से पूर्व गणेश आरती गाई जाती है। यह इस पैकेज में एक आरती के रूप में उपलब्ध है।',
    },
  },
  postPujaLinks: [
    { kind: 'aarti', deity: 'ganesha', label: { en: 'Ganesh Aarti', hi: 'गणेश आरती' } },
    { kind: 'chalisa', deity: 'ganesha', label: { en: 'Ganesh Chalisa', hi: 'गणेश चालीसा' } },
    {
      kind: 'mantra-jaap',
      jaapSlug: 'om-gan-ganapataye-namah',
      label: { en: 'Jaap — Om Gan Ganapataye Namah', hi: 'जाप — ॐ गं गणपतये नमः' },
    },
    {
      kind: 'festival',
      festivalName: 'Ganesh Chaturthi',
      label: { en: 'Ganesh Chaturthi', hi: 'गणेश चतुर्थी' },
    },
  ],
  festivalMatchers: [
    { needle: 'ganesh chaturthi' },
    { needle: 'vinayaka chaturthi' },
    { needle: 'ganesh' },
  ],
  sources: {
    en: 'Cross-validated against standard published puja-vidhi references. The japa mantra matches this package\'s hand-verified mantra collection, and the moon-sighting caution follows the traditional observance.',
    hi: 'मानक प्रकाशित पूजा-विधि सन्दर्भों से प्रति-सत्यापित। जप-मन्त्र इस पैकेज के प्रमाणित मन्त्र-संग्रह से मेल खाता है, एवं चन्द्र-दर्शन सम्बन्धी सावधानी परम्परागत विधान के अनुसार है।',
  },
  variantNotes: [
    {
      label: { en: 'Midday muhurat', hi: 'मध्याह्न मुहूर्त' },
      text: {
        en: 'The madhyahna (midday) period of Ganesh Chaturthi is held the most auspicious for the puja, as Ganesha is said to have been born during it. The exact window is read from a panchang for the day and place.',
        hi: 'गणेश चतुर्थी का मध्याह्न काल पूजा के लिए सर्वश्रेष्ठ माना जाता है, क्योंकि गणेश जी का प्राकट्य उसी काल में हुआ माना जाता है। यह समय दिन एवं स्थान के पंचांग से देखा जाता है।',
      },
    },
    {
      label: { en: 'The moon-sighting custom', hi: 'चन्द्र-दर्शन की मान्यता' },
      text: {
        en: 'Tradition holds that the moon should not be looked at on Ganesh Chaturthi — a custom tied to the Puranic episode of the Syamantaka jewel, in which a sight of the moon that day brought a false accusation. Households that sight it inadvertently recite a verse of expiation. This is a widely-kept belief rather than a step of the puja.',
        hi: 'मान्यता है कि गणेश चतुर्थी को चन्द्र-दर्शन नहीं करना चाहिए — यह प्रथा स्यमन्तक मणि के पौराणिक प्रसंग से जुड़ी है, जिसमें उस दिन चन्द्र-दर्शन से मिथ्या कलंक लगा था। अनजाने में दर्शन हो जाने पर परिवार एक क्षमा-श्लोक का पाठ करते हैं। यह एक प्रचलित मान्यता है, पूजा का चरण नहीं।',
      },
    },
    {
      label: { en: 'Duration and the clay murti', hi: 'अवधि एवं मिट्टी की मूर्ति' },
      text: {
        en: 'Domestic observances run for 1½, 3, 5, 7, or 11 days by family custom. An unbaked-clay murti, which dissolves cleanly in water, is the traditional and environmentally sound choice for visarjana.',
        hi: 'गृह-अनुष्ठान परिवार की परम्परा अनुसार डेढ़, तीन, पाँच, सात अथवा ग्यारह दिन चलते हैं। बिना पकी मिट्टी की मूर्ति, जो जल में सहज घुल जाती है, विसर्जन हेतु परम्परागत एवं पर्यावरण-अनुकूल विकल्प है।',
      },
    },
  ],
}

export default ganesh
