You extract role timelines from German Handelsregister CD text.

Return valid JSON only. No markdown. No explanations.

Output schema:
{
  "roles": [
    {
      "name": "string or null",
      "titles": ["string"],
      "birth_date": "YYYY-MM-DD or null",
      "city": "string or null",
      "role": "string",
      "start_date": "YYYY-MM-DD or null",
      "end_date": "YYYY-MM-DD or null",
      "initial_marker": true
    }
  ]
}

Rules:
- The input contains entries like "## Entry 10 | 19.09.2007".
- Convert all dates from DD.MM.YYYY to YYYY-MM-DD.
- Use the entry date as the event date.
- Extract only role holders and their role timelines.

Entry decision priority:
1. If an entry says that a person no longer holds a role, close that role.
2. If an entry says that a person is appointed to a role, create a new role object.
3. If an entry says that personal data, name, city, residence, or representation authority changed, update the existing active role object. Do not create a new role object and do not close the old one.
4. A plain role heading like "Geschäftsführer:", "Vorstand:" or "Liquidator:" is an appointment only if the entry is not a change-only entry and not a removal entry.

Appointments:
- Appointment wording can include "Bestellt", "Bestellt als", "bestellt als", "nunmehr bestellt als", or a plain active role heading.
- For appointments, set start_date to the entry date and end_date to null.
- If the appointment is in the first input entry, set initial_marker to true. Otherwise set initial_marker to false.

Removals:
- Removal wording can include "Nicht mehr", "Ausgeschieden", "War Geschäftsführer:", "War Vorstand:", "War Liquidator:".
- For removals, set end_date to the entry date.
- If a removed/former person has no earlier active role object in the input, create a role object with start_date null, end_date set, and initial_marker true.

Change-only entries:
- Change-only wording can include "Geändert", "Geändert, nunmehr", "Personenbezogene Daten geändert", "Nach Änderung", "weiterhin", "Änderung des Wohnortes", "Änderung der Vertretungsbefugnis".
- A change-only entry can still contain a role heading like "Geschäftsführer:". Do not treat that heading as a new appointment.
- If birth_date is the same, treat it as the same person even if name or city changed.
- If the name changed, update the active role object to the newest name.
- If the city changed, update the active role object to the newest city.
- If only representation authority, exemption, legal authority, or responsibility changed, keep start_date and end_date unchanged.
- Never split one active role into two role objects only because of "Geändert", "Personenbezogene Daten geändert", city change, name change, or representation authority change.

Liquidator:
- Treat Liquidator as a real role.
- If an active Geschäftsführer or Vorstand becomes Liquidator, close the previous role at the same entry date and create a new Liquidator role starting at the same entry date.
- Phrases like "Nicht mehr Geschäftsführer, nunmehr Liquidator:" or "Nicht mehr Geschäftsführer, nunmehr bestellt als Liquidator:" mean: close Geschäftsführer and start Liquidator.
- Keep Liquidator end_date null unless the input explicitly removes the person as Liquidator.

Person fields:
- Do not reorder names. Keep "Last, First" if the source uses "Last, First".
- Put academic or professional titles in titles, not in name.
- Name must not contain city, birth date, role, or representation text.
- Match people by birth_date first, then by name when birth_date is missing.
- Unknown values must be null. Empty titles must be [].

Timeline:
- If a role is still active, end_date must be null.
- If the same person is appointed, removed, and later appointed again, create separate role objects.
- If a person appears only as removed/former role holder without a known previous appointment, set initial_marker to true.

Example input:
## Entry 1 | 10.01.2001
Geschäftsführer:
Dr. Sommer, Lena, Köln, *12.03.1975
einzelvertretungsberechtigt.
Geschäftsführer:
Brandt, Felix, München, *04.05.1968

## Entry 4 | 20.06.2005
Nicht mehr
Geschäftsführer:
Dr. Sommer, Lena, Köln, *12.03.1975
Bestellt:
Geschäftsführer:
Keller, Martin, Bonn, *01.02.1970

Example output:
{
  "roles": [
    {
      "name": "Sommer, Lena",
      "titles": ["Dr."],
      "birth_date": "1975-03-12",
      "city": "Köln",
      "role": "Geschäftsführer",
      "start_date": "2001-01-10",
      "end_date": "2005-06-20",
      "initial_marker": true
    },
    {
      "name": "Brandt, Felix",
      "titles": [],
      "birth_date": "1968-05-04",
      "city": "München",
      "role": "Geschäftsführer",
      "start_date": "2001-01-10",
      "end_date": null,
      "initial_marker": true
    },
    {
      "name": "Keller, Martin",
      "titles": [],
      "birth_date": "1970-02-01",
      "city": "Bonn",
      "role": "Geschäftsführer",
      "start_date": "2005-06-20",
      "end_date": null,
      "initial_marker": false
    }
  ]
}

Example input:
## Entry 2 | 05.02.2010
Bestellt:
Geschäftsführer:
Fischer, Laura, Bonn, *18.10.1983

## Entry 3 | 20.11.2015
Personenbezogene Daten geändert, nun:
Geschäftsführer:
Fischer, Laura Maria, Essen, *18.10.1983
mit der Befugnis im Namen der Gesellschaft mit
sich im eigenen Namen oder als Vertreter eines
Dritten Rechtsgeschäfte abzuschließen.

Example output:
{
  "roles": [
    {
      "name": "Fischer, Laura Maria",
      "titles": [],
      "birth_date": "1983-10-18",
      "city": "Essen",
      "role": "Geschäftsführer",
      "start_date": "2010-02-05",
      "end_date": null,
      "initial_marker": false
    }
  ]
}

Example input:
## Entry 7 | 03.04.2012
War Vorstand:
Prof. Dr. Weber, Clara, Hamburg, *20.09.1960
Bestellt als
Vorstand:
Dipl.-Kfm. Neumann, Thomas, Essen, *11.11.1977

Example output:
{
  "roles": [
    {
      "name": "Weber, Clara",
      "titles": ["Prof. Dr."],
      "birth_date": "1960-09-20",
      "city": "Hamburg",
      "role": "Vorstand",
      "start_date": null,
      "end_date": "2012-04-03",
      "initial_marker": true
    },
    {
      "name": "Neumann, Thomas",
      "titles": ["Dipl.-Kfm."],
      "birth_date": "1977-11-11",
      "city": "Essen",
      "role": "Vorstand",
      "start_date": "2012-04-03",
      "end_date": null,
      "initial_marker": false
    }
  ]
}

Example input:
## Entry 2 | 12.05.2006
Bestellt:
Geschäftsführer:
Schmidt, Peter, Essen, *10.10.1965

## Entry 9 | 30.08.2014
Nicht mehr Geschäftsführer, nunmehr
Liquidator:
Schmidt, Peter, Essen, *10.10.1965

Example output:
{
  "roles": [
    {
      "name": "Schmidt, Peter",
      "titles": [],
      "birth_date": "1965-10-10",
      "city": "Essen",
      "role": "Geschäftsführer",
      "start_date": "2006-05-12",
      "end_date": "2014-08-30",
      "initial_marker": false
    },
    {
      "name": "Schmidt, Peter",
      "titles": [],
      "birth_date": "1965-10-10",
      "city": "Essen",
      "role": "Liquidator",
      "start_date": "2014-08-30",
      "end_date": null,
      "initial_marker": false
    }
  ]
}

Now extract roles from this input:

## Entry 1 | 03.09.2013
Geschäftsführer:
Guby, Gertrud, Butzbach, *02.04.1958
einzelvertretungsberechtigt mit der Befugnis, im
Namen der Gesellschaft mit sich im eigenen
Namen oder als Vertreter eines Dritten
Rechtsgeschäfte abzuschließen.

## Entry 2 | 12.09.2013
Personenbezogene Daten von Amts wegen
berichtigt, nun:
Geschäftsführer:
Guby, Jutta Roselinde Gertrud, Butzbach,
*02.04.1958
einzelvertretungsberechtigt mit der Befugnis, im
Namen der Gesellschaft mit sich im eigenen
Namen oder als Vertreter eines Dritten
Rechtsgeschäfte abzuschließen.

## Entry 4 | 12.07.2017
Personenbezogene Daten geändert, nun:
Geschäftsführer:
Guby, Jutta Rosalinde Gertrud, Butzbach,
*02.04.1958
einzelvertretungsberechtigt mit der Befugnis, im
Namen der Gesellschaft mit sich im eigenen
Namen oder als Vertreter eines Dritten
Rechtsgeschäfte abzuschließen.

