-- t-paliad-131 Phase B3 (continued): DE instance-split proceeding types.
--
-- Today's DE_INF tree mixes the LG cycle with two trailing rows
-- (Berufung + Berufungsbegründung) that conceptually belong to the OLG
-- instance. DE_NULL similarly trails into BGH-Berufung. Per design §3.4
-- ("Full Appeal Chain") we want each instance as its own proceeding so
-- the user can pick "I'm at OLG defending a Berufung" and get the full
-- OLG cycle (Berufungserwiderung, Anschlussberufung, mündl. Verhandlung,
-- OLG-Urteil) — not just the appeal-period entry.
--
-- Three new types in this migration. The existing trailing rows on
-- DE_INF / DE_NULL stay in place during the transition (Phase D's
-- Full-Appeal-Chain checkbox will eventually stitch the per-instance
-- timelines together; until then, users picking the LG/BPatG tree still
-- see the appeal-period entries as before).
--
-- Anchor convention for the new trees: a synthetic 0-duration root
-- "Zustellung des [previous-instance] Urteils" with party='both' and
-- event_type='filing' so it renders as IsRootEvent (= the trigger
-- date). event_type='filing' is a semantic stretch (the user is
-- being served, not filing) but matches the existing IsRootEvent
-- gating without needing a schema change to event_type.
--
-- Rule sources (German civil + patent procedure law):
--   ZPO §517 — Berufungsfrist (1 Monat ab Urteilszustellung)
--   ZPO §520(2) — Berufungsbegründung (2 Monate ab Urteilszustellung)
--   ZPO §521(2) — Berufungserwiderung (richterliche Frist, typ. 4 Wochen)
--   ZPO §524(2) — Anschlussberufung (bis Ablauf der §521-Frist)
--   ZPO §544(1) — Nichtzulassungsbeschwerde (1 Monat ab Urteilszustellung)
--   ZPO §544(4) — NZB-Begründung (2 Monate ab Urteilszustellung)
--   ZPO §548 — Revisionsfrist (1 Monat ab Urteilszustellung)
--   ZPO §551(2) — Revisionsbegründung (2 Monate ab Urteilszustellung)
--   ZPO §554 — Revisionserwiderung (richterliche Frist)
--   PatG §110(1) — BGH-Berufungsfrist (1 Monat)
--   PatG §111(1) — BGH-Berufungsbegründung (3 Monate)
--   PatG §111(3) → ZPO §521 — BGH-Berufungserwiderung (richterliche Frist)

-- ============================================================================
-- 1. New proceeding types
-- ============================================================================

INSERT INTO paliad.proceeding_types (code, name, name_en, description, jurisdiction, category, default_color, sort_order, is_active)
VALUES
    ('DE_INF_OLG',  'Berufung OLG (Verletzung)',           'Appeal OLG (Infringement)',
        'OLG-Berufungsverfahren gegen ein patentrechtliches LG-Urteil. Trigger ist die Zustellung des LG-Urteils.',
        'DE', 'fristenrechner', '#1d4ed8', 210, true),
    ('DE_INF_BGH',  'Revision/NZB BGH (Verletzung)',       'Revision / Non-admission Appeal BGH (Infringement)',
        'BGH-Verfahren gegen ein patentrechtliches OLG-Urteil — Revision oder Nichtzulassungsbeschwerde. Trigger ist die Zustellung des OLG-Urteils.',
        'DE', 'fristenrechner', '#1d4ed8', 220, true),
    ('DE_NULL_BGH', 'Berufung BGH (Nichtigkeit)',          'Appeal BGH (Nullity)',
        'BGH-Berufungsverfahren gegen ein BPatG-Nichtigkeitsurteil. Trigger ist die Zustellung des BPatG-Urteils.',
        'DE', 'fristenrechner', '#1d4ed8', 230, true)
ON CONFLICT (code) DO UPDATE SET
    name           = EXCLUDED.name,
    name_en        = EXCLUDED.name_en,
    description    = EXCLUDED.description,
    jurisdiction   = EXCLUDED.jurisdiction,
    category       = EXCLUDED.category,
    default_color  = EXCLUDED.default_color,
    sort_order     = EXCLUDED.sort_order,
    is_active      = EXCLUDED.is_active;

-- ============================================================================
-- 2. New DE-only concepts (NZB / Revision)
-- ============================================================================

INSERT INTO paliad.deadline_concepts (slug, name_de, name_en, description, aliases, party, category, sort_order) VALUES
    ('nichtzulassungsbeschwerde',             'Nichtzulassungsbeschwerde',             'Non-admission Appeal (NZB)',
        'Beschwerde gegen die Nichtzulassung der Revision in einem OLG-Urteil (§ 544 ZPO). 1-Monats-Frist ab Urteilszustellung. DE-spezifisches Rechtsmittel — kein UPC/EPC-Äquivalent.',
        ARRAY['Nichtzulassungsbeschwerde', 'NZB', 'non-admission appeal', 'Nichtzulassungs­beschwerde'],
        'both', 'submission', 35),
    ('nichtzulassungsbeschwerde-begruendung', 'Nichtzulassungsbeschwerde-Begründung',  'NZB Statement of Grounds',
        'Begründung der Nichtzulassungsbeschwerde (§ 544(4) ZPO) — 2 Monate ab Urteilszustellung, eigenständige Frist neben der NZB-Einlegung.',
        ARRAY['NZB-Begründung', 'NZB Begründung', 'Begründung Nichtzulassungsbeschwerde'],
        'both', 'submission', 36),
    ('revisionsfrist',                        'Revisionsfrist',                        'Revision Period',
        'Frist zur Einlegung der Revision beim BGH (§ 548 ZPO) — 1 Monat ab Urteilszustellung. DE-spezifisches Rechtsmittel.',
        ARRAY['Revisionsfrist', 'Revision', 'Einlegung Revision'],
        'both', 'submission', 37),
    ('revisionsbegruendung',                  'Revisionsbegründung',                   'Revision Statement of Grounds',
        'Begründung der Revision beim BGH (§ 551(2) ZPO) — 2 Monate ab Urteilszustellung.',
        ARRAY['Revisionsbegründung', 'Begründung Revision'],
        'both', 'submission', 38)
ON CONFLICT (slug) DO UPDATE SET
    name_de       = EXCLUDED.name_de,
    name_en       = EXCLUDED.name_en,
    description   = EXCLUDED.description,
    aliases       = EXCLUDED.aliases,
    party         = EXCLUDED.party,
    sort_order    = EXCLUDED.sort_order,
    updated_at    = now();

-- ============================================================================
-- 3. DE_INF_OLG rules (anchor = LG-Urteil-Zustellung)
-- ============================================================================

-- Wave 0: anchor row (root event)
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, NULL,
    'de_inf_olg.urteil_lg', 'Zustellung LG-Urteil', 'Service of LG Judgment',
    'both', 'filing', true, 0, 'months', 'after', NULL,
    'Zustellung des erstinstanzlichen Urteils (Trigger für die OLG-Berufungsfristen).',
    'Service of the LG judgment (trigger for the OLG appeal deadlines).',
    0, NULL, NULL, NULL, false, true
FROM paliad.proceeding_types pt
WHERE pt.code = 'DE_INF_OLG';

-- Wave 1: rules anchored on urteil_lg
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id, new.code, new.name, new.name_en, new.primary_party, new.event_type,
    true, new.duration_value, new.duration_unit, 'after', new.rule_code, new.deadline_notes, new.deadline_notes_en,
    new.sequence_order, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = new.concept_slug),
    new.legal_source, false, true
FROM (VALUES
    ('de_inf_olg.urteil_lg', 'de_inf_olg.berufung',    'Berufungsschrift',           'Notice of Appeal',
        'both', 'filing', 1, 'months', '§ 517 ZPO',
        'Berufung muss binnen 1 Monat ab Zustellung des Urteils eingelegt werden (§ 517 ZPO). Spätestens 5 Monate nach Verkündung.',
        'Notice of appeal must be filed within 1 month of service of the judgment (ZPO §517). At the latest 5 months after pronouncement.',
        10, 'notice-of-appeal',                  'DE.ZPO.517'),
    ('de_inf_olg.urteil_lg', 'de_inf_olg.begruendung', 'Berufungsbegründung',        'Statement of Grounds of Appeal',
        'both', 'filing', 2, 'months', '§ 520 ZPO',
        'Berufung muss binnen 2 Monaten ab Urteilszustellung begründet werden (§ 520(2) ZPO). Verlängerung um max. 1 Monat auf Antrag möglich.',
        'The appeal must be substantiated within 2 months of service of the judgment (ZPO §520(2)). Extension by up to 1 month possible on request.',
        20, 'statement-of-grounds-of-appeal',    'DE.ZPO.520.2'),
    ('de_inf_olg.urteil_lg', 'de_inf_olg.termin',      'Mündliche Verhandlung',      'Oral Hearing',
        'court', 'hearing', 0, 'months', NULL, NULL, NULL, 50, 'oral-hearing', NULL),
    ('de_inf_olg.urteil_lg', 'de_inf_olg.urteil_olg',  'OLG-Urteil',                 'OLG Judgment',
        'court', 'decision', 0, 'months', NULL, NULL, NULL, 60, 'decision', NULL)
) AS new(parent_code, code, name, name_en, primary_party, event_type, duration_value, duration_unit, rule_code, deadline_notes, deadline_notes_en, sequence_order, concept_slug, legal_source)
JOIN paliad.proceeding_types pt ON pt.code = 'DE_INF_OLG'
JOIN paliad.deadline_rules    parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = new.parent_code;

-- Wave 2: Berufungserwiderung (parent=begruendung) + Anschlussberufung (parent=erwiderung)
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id, new.code, new.name, new.name_en, new.primary_party, new.event_type,
    true, new.duration_value, new.duration_unit, 'after', new.rule_code, new.deadline_notes, new.deadline_notes_en,
    new.sequence_order, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = new.concept_slug),
    new.legal_source, false, true
FROM (VALUES
    ('de_inf_olg.begruendung', 'de_inf_olg.erwiderung', 'Berufungserwiderung', 'Response to Appeal',
        'both', 'filing', 1, 'months', '§ 521 ZPO',
        'Erwiderung auf die Berufungsbegründung — vom Gericht gesetzte Frist (§ 521(2) ZPO), typischerweise mindestens 1 Monat.',
        'Response to the Statement of Grounds of Appeal — court-set deadline (ZPO §521(2)), typically at least 1 month.',
        30, 'response-to-appeal', 'DE.ZPO.521.2')
) AS new(parent_code, code, name, name_en, primary_party, event_type, duration_value, duration_unit, rule_code, deadline_notes, deadline_notes_en, sequence_order, concept_slug, legal_source)
JOIN paliad.proceeding_types pt ON pt.code = 'DE_INF_OLG'
JOIN paliad.deadline_rules    parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = new.parent_code;

-- Wave 3: Anschlussberufung (parent=erwiderung)
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id,
    'de_inf_olg.anschluss', 'Anschlussberufung', 'Cross-Appeal',
    'both', 'filing', false, 0, 'months', 'after', '§ 524 ZPO',
    'Anschlussberufung bis zum Ablauf der Frist zur Berufungserwiderung (§ 524(2) ZPO). Mit Erwiderung gleichzeitig einreichbar.',
    'Cross-appeal until expiry of the deadline for the Response to Appeal (ZPO §524(2)). May be filed together with the response.',
    35, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = 'cross-appeal'),
    'DE.ZPO.524.2', false, true
FROM paliad.proceeding_types pt
JOIN paliad.deadline_rules parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = 'de_inf_olg.erwiderung'
WHERE pt.code = 'DE_INF_OLG';

-- ============================================================================
-- 4. DE_INF_BGH rules (anchor = OLG-Urteil-Zustellung)
-- ============================================================================

INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, NULL,
    'de_inf_bgh.urteil_olg', 'Zustellung OLG-Urteil', 'Service of OLG Judgment',
    'both', 'filing', true, 0, 'months', 'after', NULL,
    'Zustellung des Berufungsurteils des OLG (Trigger für NZB / Revisionsfristen).',
    'Service of the OLG appeal judgment (trigger for NZB / revision deadlines).',
    0, NULL, NULL, NULL, false, true
FROM paliad.proceeding_types pt
WHERE pt.code = 'DE_INF_BGH';

-- All rules anchored on the OLG-Urteil — they are PARALLEL options
-- (NZB if revision wasn't admitted; Revision if it was), not sequential.
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id, new.code, new.name, new.name_en, new.primary_party, new.event_type,
    true, new.duration_value, new.duration_unit, 'after', new.rule_code, new.deadline_notes, new.deadline_notes_en,
    new.sequence_order, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = new.concept_slug),
    new.legal_source, false, true
FROM (VALUES
    ('de_inf_bgh.urteil_olg', 'de_inf_bgh.nzb',          'Nichtzulassungsbeschwerde',           'Non-admission Appeal',
        'both', 'filing', 1, 'months', '§ 544 ZPO',
        'NZB binnen 1 Monat ab Zustellung des OLG-Urteils einlegen (§ 544(1) ZPO). Wird gegen Nichtzulassung der Revision eingelegt.',
        'Non-admission appeal within 1 month of service of the OLG judgment (ZPO §544(1)). Filed against the OLG''s refusal to admit revision.',
        10, 'nichtzulassungsbeschwerde',           'DE.ZPO.544.1'),
    ('de_inf_bgh.urteil_olg', 'de_inf_bgh.nzb_begr',     'Nichtzulassungsbeschwerde-Begründung','NZB Statement of Grounds',
        'both', 'filing', 2, 'months', '§ 544 ZPO',
        'Begründung der NZB binnen 2 Monaten ab Urteilszustellung (§ 544(4) ZPO). Eigenständige Frist neben der NZB-Einlegung.',
        'NZB Statement of Grounds within 2 months of service of the judgment (ZPO §544(4)). Separate from the NZB filing deadline.',
        20, 'nichtzulassungsbeschwerde-begruendung','DE.ZPO.544.4'),
    ('de_inf_bgh.urteil_olg', 'de_inf_bgh.revision',     'Revisionsfrist',                       'Revision Period',
        'both', 'filing', 1, 'months', '§ 548 ZPO',
        'Revision binnen 1 Monat ab Zustellung des Urteils einlegen (§ 548 ZPO).',
        'Revision must be filed within 1 month of service of the judgment (ZPO §548).',
        30, 'revisionsfrist',                      'DE.ZPO.548'),
    ('de_inf_bgh.urteil_olg', 'de_inf_bgh.revisionsbegr','Revisionsbegründung',                  'Revision Statement of Grounds',
        'both', 'filing', 2, 'months', '§ 551 ZPO',
        'Begründung der Revision binnen 2 Monaten ab Urteilszustellung (§ 551(2) ZPO). Verlängerung um max. 2 Monate auf Antrag möglich.',
        'Revision Statement of Grounds within 2 months of service of the judgment (ZPO §551(2)). Extension by up to 2 months possible on request.',
        40, 'revisionsbegruendung',                'DE.ZPO.551.2')
) AS new(parent_code, code, name, name_en, primary_party, event_type, duration_value, duration_unit, rule_code, deadline_notes, deadline_notes_en, sequence_order, concept_slug, legal_source)
JOIN paliad.proceeding_types pt ON pt.code = 'DE_INF_BGH'
JOIN paliad.deadline_rules    parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = new.parent_code;

-- Revisionserwiderung (parent=revisionsbegr)
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id,
    'de_inf_bgh.revisionserw', 'Revisionserwiderung', 'Response to Revision',
    'both', 'filing', false, 1, 'months', 'after', '§ 554 ZPO',
    'Erwiderung auf die Revisionsbegründung — vom Gericht gesetzte Frist (§ 554 ZPO), typischerweise mindestens 1 Monat.',
    'Response to the Revision Statement of Grounds — court-set deadline (ZPO §554), typically at least 1 month.',
    50, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = 'response-to-appeal'),
    'DE.ZPO.554', false, true
FROM paliad.proceeding_types pt
JOIN paliad.deadline_rules parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = 'de_inf_bgh.revisionsbegr'
WHERE pt.code = 'DE_INF_BGH';

-- BGH terminal hearing + decision
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id, new.code, new.name, new.name_en, new.primary_party, new.event_type,
    true, new.duration_value, new.duration_unit, 'after', new.rule_code, new.deadline_notes, new.deadline_notes_en,
    new.sequence_order, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = new.concept_slug),
    new.legal_source, false, true
FROM (VALUES
    ('de_inf_bgh.urteil_olg', 'de_inf_bgh.termin',      'Mündliche Verhandlung BGH',  'BGH Oral Hearing',
        'court', 'hearing',  0, 'months', NULL, NULL, NULL, 70, 'oral-hearing', NULL),
    ('de_inf_bgh.urteil_olg', 'de_inf_bgh.urteil_bgh',  'BGH-Urteil',                 'BGH Judgment',
        'court', 'decision', 0, 'months', NULL, NULL, NULL, 80, 'decision', NULL)
) AS new(parent_code, code, name, name_en, primary_party, event_type, duration_value, duration_unit, rule_code, deadline_notes, deadline_notes_en, sequence_order, concept_slug, legal_source)
JOIN paliad.proceeding_types pt ON pt.code = 'DE_INF_BGH'
JOIN paliad.deadline_rules    parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = new.parent_code;

-- ============================================================================
-- 5. DE_NULL_BGH rules (anchor = BPatG-Urteil-Zustellung)
-- ============================================================================

INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, NULL,
    'de_null_bgh.urteil_bpatg', 'Zustellung BPatG-Urteil', 'Service of BPatG Judgment',
    'both', 'filing', true, 0, 'months', 'after', NULL,
    'Zustellung des Nichtigkeitsurteils des BPatG (Trigger für die BGH-Berufungsfristen).',
    'Service of the BPatG nullity judgment (trigger for the BGH appeal deadlines).',
    0, NULL, NULL, NULL, false, true
FROM paliad.proceeding_types pt
WHERE pt.code = 'DE_NULL_BGH';

INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id, new.code, new.name, new.name_en, new.primary_party, new.event_type,
    true, new.duration_value, new.duration_unit, 'after', new.rule_code, new.deadline_notes, new.deadline_notes_en,
    new.sequence_order, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = new.concept_slug),
    new.legal_source, false, true
FROM (VALUES
    ('de_null_bgh.urteil_bpatg', 'de_null_bgh.berufung',     'Berufungsschrift',     'Notice of Appeal',
        'both', 'filing', 1, 'months', '§ 110 PatG',
        'Berufung beim BGH binnen 1 Monat ab Zustellung des BPatG-Urteils einlegen (§ 110(1) PatG).',
        'Notice of appeal to the BGH within 1 month of service of the BPatG judgment (PatG §110(1)).',
        10, 'notice-of-appeal',                  'DE.PatG.110.1'),
    ('de_null_bgh.urteil_bpatg', 'de_null_bgh.begruendung',  'Berufungsbegründung',  'Statement of Grounds of Appeal',
        'both', 'filing', 3, 'months', '§ 111 PatG',
        'Berufung muss binnen 3 Monaten ab Zustellung des Urteils begründet werden (§ 111(1) PatG); spätestens 5 Monate nach Verkündung.',
        'The appeal must be substantiated within 3 months of service of the judgment (PatG §111(1)); at the latest 5 months after pronouncement.',
        20, 'statement-of-grounds-of-appeal',    'DE.PatG.111.1'),
    ('de_null_bgh.urteil_bpatg', 'de_null_bgh.termin',       'Mündliche Verhandlung BGH', 'BGH Oral Hearing',
        'court', 'hearing',  0, 'months', NULL, NULL, NULL, 50, 'oral-hearing', NULL),
    ('de_null_bgh.urteil_bpatg', 'de_null_bgh.urteil_bgh',   'BGH-Urteil',           'BGH Judgment',
        'court', 'decision', 0, 'months', NULL, NULL, NULL, 60, 'decision', NULL)
) AS new(parent_code, code, name, name_en, primary_party, event_type, duration_value, duration_unit, rule_code, deadline_notes, deadline_notes_en, sequence_order, concept_slug, legal_source)
JOIN paliad.proceeding_types pt ON pt.code = 'DE_NULL_BGH'
JOIN paliad.deadline_rules    parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = new.parent_code;

-- Berufungserwiderung BGH (parent=begruendung)
INSERT INTO paliad.deadline_rules (
    proceeding_type_id, parent_id, code, name, name_en, primary_party, event_type,
    is_mandatory, duration_value, duration_unit, timing, rule_code, deadline_notes, deadline_notes_en,
    sequence_order, condition_flag, concept_id, legal_source, is_spawn, is_active
)
SELECT
    pt.id, parent_rule.id,
    'de_null_bgh.erwiderung', 'Berufungserwiderung', 'Response to Appeal',
    'both', 'filing', false, 2, 'months', 'after', '§ 111 PatG',
    'Erwiderung auf die BGH-Berufungsbegründung (§ 111(3) PatG i.V.m. § 521(2) ZPO) — vom Gericht gesetzte Frist, typischerweise ~2 Monate.',
    'Response to the BGH Statement of Grounds (PatG §111(3) read with ZPO §521(2)) — court-set deadline, typically ~2 months.',
    30, NULL,
    (SELECT id FROM paliad.deadline_concepts WHERE slug = 'response-to-appeal'),
    'DE.PatG.111.3', false, true
FROM paliad.proceeding_types pt
JOIN paliad.deadline_rules parent_rule ON parent_rule.proceeding_type_id = pt.id AND parent_rule.code = 'de_null_bgh.begruendung'
WHERE pt.code = 'DE_NULL_BGH';
