HAALCENTRAAL English translation
BRP API / Personen / Features / gegeven-stap-definities-verblijfplaats

Verblijfplaats Given step definitions

# language: en
@stap-documentatie
Feature: Verblijfplaats Given step definitions
  In order to be able to write scenarios for the BRP APIs, this feature describes which SQL statements are generated and executed for a Given step.
  These SQL statements are in the table of the 'Dan zijn de gegenereerde SQL statements' step. Each row in the table indicates
  - which Given step the SQL statement belongs to (the stap column indicates the step within the scenario: 1 = 1st step, 2 = 2nd step, etc.)
  - which BRP category the SQL statement belongs to (the categorie column)
  - what the SQL statement is (the text column)
  - which values are passed when the SQL statement is executed (the values column)

  Background:
    Given the 1st 'SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres' statement has the result '4999'
    And the 2nd 'SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres' statement has the result '5000'
    And the 3rd 'SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres' statement has the result '5001'
    And the 1st 'SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl' statement has the result '9999'
    And the 2nd 'SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl' statement has the result '10000'
    And the 3rd 'SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl' statement has the result '10001'

  @integratie
  Scenario: is registered in the BRP
    Given person 'P1' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000012 | Jansen                |
    * is registered in the BRP
    When the SQL statements generated from the Given steps have been executed
    Then person 'P1' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | volg_nr | inschrijving_gemeente_code |
      | P1    |       0 |                       0518 |

  @integratie
  Scenario: is not registered in the BRP
    Given person 'P1' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000012 | Jansen                |
    * is not registered in the BRP
    When the SQL statements generated from the Given steps have been executed
    Then person 'P1' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | volg_nr | inschrijving_gemeente_code |
      | P1    |       0 |                       1999 |

  @integratie
  Scenario Outline: person '[persoon aanduiding]' is registered at address '[adres aanduiding]' on [<datum type>]
    Given address 'A1'
      | gemeentecode (92.10) |
      |                 0518 |
    And person 'P1' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000012 | Jansen                |
    And <stap>
    When the SQL statements generated from the Given steps have been executed
    Then person 'P1' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | adres_id | volg_nr | adres_functie | inschrijving_gemeente_code | adreshouding_start_datum |
      | P1    | A1       |       0 | W             |                       0518 | <datum>                  |

    Examples:
      | stap                                                              | datum    | datum type                 |
      | persoon 'P1' is op 1 januari 2021 ingeschreven op adres 'A1'      | 20210101 | datum                      |
      | 'P1' is op 1 januari 2021 ingeschreven op adres 'A1'              | 20210101 | datum                      |
      | persoon 'P1' is in februari 2022 ingeschreven op adres 'A1'       | 20220200 | jaar maand datum           |
      | 'P1' is in februari 2022 ingeschreven op adres 'A1'               | 20220200 | jaar maand datum           |
      | persoon 'P1' is in 2023 ingeschreven op adres 'A1'                | 20230000 | jaar datum                 |
      | 'P1' is in 2023 ingeschreven op adres 'A1'                        | 20230000 | jaar datum                 |
      | persoon 'P1' is op een onbekende datum ingeschreven op adres 'A1' | 00000000 | onbekende datum            |
      | 'P1' is op een onbekende datum ingeschreven op adres 'A1'         | 00000000 | onbekende datum            |
      | persoon 'P1' is op 01-01-2021 ingeschreven op adres 'A1'          | 20210101 | datum in dd-mm-yyyy format |
      | 'P1' is op 01-01-2021 ingeschreven op adres 'A1'                  | 20210101 | datum in dd-mm-yyyy format |

  @integratie
  Scenario Outline: persons '[persoon aanduidingen]' are registered at address '[adres aanduiding]' on [<datum type>]
    Given address 'A1'
      | gemeentecode (92.10) |
      |                 0518 |
    Given person 'P1' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000012 | Jansen                |
    And person 'P2' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000024 | Albers                |
    And <stap>
    When the SQL statements generated from the Given steps have been executed
    Then person 'P1' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | adres_id | volg_nr | adres_functie | inschrijving_gemeente_code | adreshouding_start_datum |
      | P1    | A1       |       0 | W             |                       0518 | <datum>                  |
    And person 'P2' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | adres_id | volg_nr | adres_functie | inschrijving_gemeente_code | adreshouding_start_datum |
      | P2    | A1       |       0 | W             |                       0518 | <datum>                  |

    Examples:
      | stap                                                               | datum    | datum type                 |
      | personen 'P1,P2' zijn op 1 januari 2021 ingeschreven op adres 'A1' | 20210101 | datum                      |
      | 'P1,P2' zijn op 1 januari 2021 ingeschreven op adres 'A1'          | 20210101 | datum                      |
      | personen 'P1, P2' zijn in februari 2022 ingeschreven op adres 'A1' | 20220200 | jaar maand datum           |
      | 'P1, P2' zijn in februari 2022 ingeschreven op adres 'A1'          | 20220200 | jaar maand datum           |
      | personen 'P1 en P2' zijn in 2023 ingeschreven op adres 'A1'        | 20230000 | jaar datum                 |
      | 'P1 en P2' zijn in 2023 ingeschreven op adres 'A1'                 | 20230000 | jaar datum                 |
      | 'P1 en P2' zijn op een onbekende datum ingeschreven op adres 'A1'  | 00000000 | onbekende datum            |
      | personen 'P1,P2' zijn op 01-01-2021 ingeschreven op adres 'A1'     | 20210101 | datum in dd-mm-yyyy format |
      | 'P1,P2' zijn op 01-01-2021 ingeschreven op adres 'A1'              | 20210101 | datum in dd-mm-yyyy format |

  @integratie
  Scenario Outline: person '[persoon aanduiding]' was registered at address '[adres aanduiding]' [aantal] years ago [gisteren, vandaag of morgen]
    Given address 'A1'
      | gemeentecode (92.10) |
      |                 0518 |
    And person 'P1' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000012 | Jansen                |
    And <stap>
    When the SQL statements generated from the Given steps have been executed
    Then person 'P1' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | adres_id | volg_nr | adres_functie | inschrijving_gemeente_code | adreshouding_start_datum |
      | P1    | A1       |       0 | W             |                       0518 | <datum>                  |

    Examples:
      | stap                                                       | datum             |
      | persoon 'P1' is 2 jaar geleden ingeschreven op adres 'A1'  | vandaag - 2 jaar  |
      | 'P1' is 2 jaar geleden ingeschreven op adres 'A1'          | vandaag - 2 jaar  |
      | 'P1' is vandaag 2 jaar geleden ingeschreven op adres 'A1'  | vandaag - 2 jaar  |
      | 'P1' is gisteren 1 jaar geleden ingeschreven op adres 'A1' | gisteren - 1 jaar |
      | 'P1' is morgen 3 jaar geleden ingeschreven op adres 'A1'   | morgen - 3 jaar   |

  @integratie
  Scenario Outline: person '[persoon aanduiding]' was registered at address '[adres aanduiding]' [aantal] years ago [gisteren, vandaag of morgen] with the following data
    Given address 'A1'
      | gemeentecode (92.10) |
      |                 0518 |
    And person 'P1' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000012 | Jansen                |
    And <stap> with the following data
      | gemeente van inschrijving (09.10) |
      |                              0344 |
    When the SQL statements generated from the Given steps have been executed
    Then person 'P1' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | adres_id | volg_nr | adres_functie | inschrijving_gemeente_code | adreshouding_start_datum |
      | P1    | A1       |       0 | W             |                       0344 | <datum>                  |

    Examples:
      | stap                                                       | datum             |
      | persoon 'P1' is 2 jaar geleden ingeschreven op adres 'A1'  | vandaag - 2 jaar  |
      | 'P1' is 2 jaar geleden ingeschreven op adres 'A1'          | vandaag - 2 jaar  |
      | 'P1' is vandaag 2 jaar geleden ingeschreven op adres 'A1'  | vandaag - 2 jaar  |
      | 'P1' is gisteren 1 jaar geleden ingeschreven op adres 'A1' | gisteren - 1 jaar |
      | 'P1' is morgen 3 jaar geleden ingeschreven op adres 'A1'   | morgen - 3 jaar   |

  @integratie
  Scenario Outline: persons '[persoon aanduidingen]' were registered at address '[adres aanduiding]' [aantal] years ago [gisteren, vandaag of morgen]
    Given address 'A1'
      | gemeentecode (92.10) |
      |                 0518 |
    And person 'P1' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000012 | Jansen                |
    And person 'P2' has the following data
      | burgerservicenummer (01.20) | geslachtsnaam (02.40) |
      |                   000000024 | Albers                |
    And <stap>
    When the SQL statements generated from the Given steps have been executed
    Then person 'P1' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | adres_id | volg_nr | adres_functie | inschrijving_gemeente_code | adreshouding_start_datum |
      | P1    | A1       |       0 | W             |                       0518 | <datum>                  |
    And person 'P2' has the following row in table 'lo3_pl_verblijfplaats'
      | pl_id | adres_id | volg_nr | adres_functie | inschrijving_gemeente_code | adreshouding_start_datum |
      | P2    | A1       |       0 | W             |                       0518 | <datum>                  |

    Examples:
      | stap                                                                       | datum             |
      | personen 'P1,P2' zijn 2 jaar geleden ingeschreven op adres 'A1'            | vandaag - 2 jaar  |
      | 'P1, P2' zijn 2 jaar geleden ingeschreven op adres 'A1'                    | vandaag - 2 jaar  |
      | personen 'P1 en P2' zijn vandaag 2 jaar geleden ingeschreven op adres 'A1' | vandaag - 2 jaar  |
      | 'P1, P2' zijn gisteren 1 jaar geleden ingeschreven op adres 'A1'           | gisteren - 1 jaar |
      | 'P1 en P2' zijn morgen 3 jaar geleden ingeschreven op adres 'A1'           | morgen - 3 jaar   |

  Scenario: the person with citizen service number '[bsn]' is registered at address '[identificatie]' with the following data
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
      | datum aanvang adreshouding (10.30) |
      |                           20230102 |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                 |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep              |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                      |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012   |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,0,W,20230102 |

  Scenario: the person with citizen service number '[bsn]' is registered at address '[identificatie]' with the following data (several registrations)
    Given address 'A1' has the following data
    | naam               | waarde    |
    | straatnaam (11.10) | Boterdiep |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    And the person with citizen service number '000000013' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230203                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                  |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep               |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                       |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012    |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,0,W,20230102  |
    | 3    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                       |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 10000,0,0,P,000000013   |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 10000,4999,0,W,20230203 |

  Scenario: the person with citizen service number '[bsn]' has given address '[identificatie]' as a correspondence address with the following data
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And the person with citizen service number '000000012' has given address 'A1' as a correspondence address with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                 |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep              |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                      |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012   |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,0,B,20230102 |

  Scenario: the person with citizen service number '[bsn]' is registered at a foreign address with the following data
    Given the person with citizen service number '000000012' is registered at a foreign address with the following data
    | land adres buitenland (13.10) | datum aanvang adres buitenland (13.20) |
    | 5010                          | 20230526                               |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values               |
    | 1    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                    |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012 |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,volg_nr,vertrek_land_code,vertrek_datum) VALUES($1,$2,$3,$4)                                           | 9999,0,5010,20230526 |

  Scenario: [aantal] persons are registered at address '[identificatie]' with the following data
    Given address 'A1' has the following data
    | naam               | waarde    |
    | straatnaam (11.10) | Boterdiep |
    And 3 persons are registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                  |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep               |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                       |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000001    |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,0,W,20230102  |
    | 3    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                       |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 10000,0,0,P,000000002   |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 10000,4999,0,W,20230102 |
    | 4    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                       |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 10001,0,0,P,000000003   |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 10001,4999,0,W,20230102 |

  Scenario: the person was (subsequently) registered at address '[identificatie]' with the following data
    Given address 'A1' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    And address 'A2' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067002                         |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    And the person was subsequently registered at address 'A2' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230601                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                 |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *  | 0800010011067001       |
    |      | adres-A2       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *  | 0800010011067002       |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                      |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012   |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,1,W,20230102 |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,5000,0,W,20230601 |

  Scenario: the person has (subsequently) given address '[identificatie]' as a correspondence address with the following data
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And the person with citizen service number '000000012' has the following data
    | naam                  | waarde |
    | geslachtsnaam (02.40) | Jansen |
    And the person has given address 'A1' as a correspondence address with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                      |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep                   |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                           |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr,geslachts_naam) VALUES($1,$2,$3,$4,$5,$6)                    | 9999,0,0,P,000000012,Jansen |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,0,B,20230102      |

  Scenario: the person was (subsequently) registered at a foreign address with the following data
    Given address 'A1' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20220102                           |
    And the person was subsequently registered at a foreign address with the following data
    | land adres buitenland (13.10) | datum aanvang adres buitenland (13.20) |
    | 5010                          | 20230526                               |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                 |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *  | 0800010011067001       |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                      |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012   |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,1,W,20220102 |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,volg_nr,vertrek_land_code,vertrek_datum) VALUES($1,$2,$3,$4)                                           | 9999,0,5010,20230526   |

  Scenario: merging an address at which persons are or were registered
    Given address 'A1' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20220102                           |
    And address 'A1' was merged on '2023-02-03' into address 'A2' with the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067002                         |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                        | values                   |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *        | 0800010011067001         |
    |      | adres-A2       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *        | 0800010011067002         |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *       | 0                        |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                            | 9999,0,0,P,000000012     |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                              | 9999,4999,1,W,20220102   |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6) | 9999,5000,0,W,20230203,W |

  Scenario: merging an address that is or was used as a correspondence address
    Given address 'A1' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    And the person with citizen service number '000000012' has given address 'A1' as a correspondence address with the following data
    | datum aanvang adreshouding (10.30) |
    | 20220102                           |
    And address 'A1' was merged on '2023-02-03' into address 'A2' with the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067002                         |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                        | values                   |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *        | 0800010011067001         |
    |      | adres-A2       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *        | 0800010011067002         |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *       | 0                        |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                            | 9999,0,0,P,000000012     |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                              | 9999,4999,1,B,20220102   |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6) | 9999,5000,0,B,20230203,W |

  Scenario: merging addresses at which persons are or were registered
    Given address 'A1' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20220102                           |
    Given address 'A2' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067002                         |
    And the person with citizen service number '000000024' is registered at address 'A2' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20211201                           |
    And the addresses 'A1, A2' were merged on '2023-02-03' into address 'A3' with the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067003                         |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                        | values                    |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *        | 0800010011067001          |
    |      | adres-A2       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *        | 0800010011067002          |
    |      | adres-A3       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *        | 0800010011067003          |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *       | 0                         |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                            | 9999,0,0,P,000000012      |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                              | 9999,4999,1,W,20220102    |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6) | 9999,5001,0,W,20230203,W  |
    | 3    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *       | 0                         |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                            | 10000,0,0,P,000000024     |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                              | 10000,5000,1,W,20211201   |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6) | 10000,5001,0,W,20230203,W |

  Scenario: updating an address at which persons are or were registered
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20220102                           |
    And address 'A1' was updated on '2023-02-03' with the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                                | values                     |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                               | Boterdiep                  |
    |      | adres-2        | INSERT INTO public.lo3_adres(adres_id,straat_naam,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1,$2) RETURNING * | Boterdiep,0800010011067001 |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *               | 0                          |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                                    | 9999,0,0,P,000000012       |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                                      | 9999,4999,1,W,20220102     |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6)         | 9999,5000,0,W,20230203,T   |

  Scenario: updating an address that is or was used as a correspondence address
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And the person with citizen service number '000000012' has given address 'A1' as a correspondence address with the following data
    | datum aanvang adreshouding (10.30) |
    | 20220102                           |
    And address 'A1' was updated on '2023-02-03' with the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                                | values                     |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                               | Boterdiep                  |
    |      | adres-2        | INSERT INTO public.lo3_adres(adres_id,straat_naam,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1,$2) RETURNING * | Boterdiep,0800010011067001 |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *               | 0                          |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                                    | 9999,0,0,P,000000012       |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                                      | 9999,4999,1,B,20220102     |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6)         | 9999,5000,0,B,20230203,T   |

  Scenario: changing infrastructurally an address at which persons are or were registered
    Given address 'A1' has the following data
    | gemeentecode (92.10) | identificatiecode verblijfplaats (11.80) |
    | 0800                 | 0800010000000003                         |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) |
    | 0800                              | 20220102                           |
    And address 'A1' was changed infrastructurally on '2023-02-03' with the following data
    | gemeentecode (92.10) |
    | 0530                 |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                                                      | values                        |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,gemeente_code,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1,$2) RETURNING *                     | 0800,0800010000000003         |
    |      | adres-2        | INSERT INTO public.lo3_adres(adres_id,gemeente_code,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1,$2) RETURNING *                     | 0530,0800010000000003         |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *                                     | 0                             |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                                                          | 9999,0,0,P,000000012          |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,inschrijving_gemeente_code,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5,$6)                              | 9999,4999,1,W,0800,20220102   |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,inschrijving_gemeente_code,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6,$7) | 9999,5000,0,W,0530,20230203,W |

  Scenario: changing infrastructurally an address at which persons are or were registered into another address
    Given address 'A1' has the following data
    | gemeentecode (92.10) | identificatiecode verblijfplaats (11.80) |
    | 0800                 | 0800010000000003                         |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) |
    | 0800                              | 20220102                           |
    And address 'A1' was changed infrastructurally on '2023-02-03' to address 'A2' with the following data
    | gemeentecode (92.10) |
    | 0530                 |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                                                      | values                        |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,gemeente_code,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1,$2) RETURNING *                     | 0800,0800010000000003         |
    |      | adres-A2       | INSERT INTO public.lo3_adres(adres_id,gemeente_code,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1,$2) RETURNING *                     | 0530,0800010000000003         |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING *                                     | 0                             |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                                                          | 9999,0,0,P,000000012          |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,inschrijving_gemeente_code,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5,$6)                              | 9999,4999,1,W,0800,20220102   |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,inschrijving_gemeente_code,adreshouding_start_datum,aangifte_adreshouding_oms) VALUES($1,$2,$3,$4,$5,$6,$7) | 9999,5000,0,W,0530,20230203,W |

  Scenario: a correction of a registration at an address with an identification into another address with an identification
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And address 'A2' has the following data
    | identificatiecode verblijfplaats (11.80) |
    | 0800010011067001                         |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    And the registration was subsequently corrected as a registration at address 'A2' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230800                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                   |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep                |
    |      | adres-A2       | INSERT INTO public.lo3_adres(adres_id,verblijf_plaats_ident_code) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *  | 0800010011067001         |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                        |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012     |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,onjuist_ind) VALUES($1,$2,$3,$4,$5,$6)         | 9999,4999,1,W,20230102,O |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,5000,0,W,20230800   |

  Scenario: a correction of a registration at an address with an identification into a declaration of a correspondence address
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    And the 'verblijfplaats' has been corrected to the following data
    | functie adres (10.10) | datum aanvang adreshouding (10.30) |
    | B                     | 20230800                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                   |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep                |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                        |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012     |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,onjuist_ind) VALUES($1,$2,$3,$4,$5,$6)         | 9999,4999,1,W,20230102,O |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum) VALUES($1,$2,$3,$4,$5)                        | 9999,4999,0,B,20230800   |

  Scenario: the 'verblijfplaats' has been corrected to the following data
    Given address 'A1' has the following data
    | straatnaam (11.10) |
    | Boterdiep          |
    And the person with citizen service number '000000012' is registered at address 'A1' with the following data
    | datum aanvang adreshouding (10.30) |
    | 20230102                           |
    And the 'verblijfplaats' has been corrected to the following data
    | datum aanvang adreshouding (10.30) |
    | 20230800                           |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                   |
    | 1    | adres-A1       | INSERT INTO public.lo3_adres(adres_id,straat_naam) VALUES((SELECT COALESCE(MAX(adres_id), 0)+1 FROM public.lo3_adres),$1) RETURNING *                 | Boterdiep                |
    | 2    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                        |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012     |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adres_functie,adreshouding_start_datum,onjuist_ind) VALUES($1,$2,$3,$4,$5,$6)         | 9999,4999,1,W,20230102,O |
    |      |                | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,adres_id,volg_nr,adreshouding_start_datum) VALUES($1,$2,$3,$4)                                         | 9999,4999,0,20230800     |

  Scenario: the person with citizen service number '[bsn]' has the following 'verblijfplaats' data
    Given the person with citizen service number '000000012' has the following 'verblijfplaats' data
    | naam                              | waarde |
    | land vanwaar ingeschreven (14.10) | 0000   |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values               |
    | 1    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                    |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr) VALUES($1,$2,$3,$4,$5)                                      | 9999,0,0,P,000000012 |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,volg_nr,vestiging_land_code) VALUES($1,$2,$3)                                                          | 9999,0,0000          |

  Scenario: the person has the following 'verblijfplaats' data
    Given the person with citizen service number '000000012' has the following data
    | naam                  | waarde |
    | geslachtsnaam (02.40) | Jansen |
    And the person has the following 'verblijfplaats' data
    | naam                              | waarde |
    | gemeente van inschrijving (09.10) | 1999   |
    Then the generated SQL statements are
    | stap | categorie      | text                                                                                                                                                  | values                      |
    | 1    | inschrijving   | INSERT INTO public.lo3_pl(pl_id,mutatie_dt,geheim_ind) VALUES((SELECT COALESCE(MAX(pl_id), 0)+1 FROM public.lo3_pl),current_timestamp,$1) RETURNING * | 0                           |
    |      | persoon        | INSERT INTO public.lo3_pl_persoon(pl_id,stapel_nr,volg_nr,persoon_type,burger_service_nr,geslachts_naam) VALUES($1,$2,$3,$4,$5,$6)                    | 9999,0,0,P,000000012,Jansen |
    |      | verblijfplaats | INSERT INTO public.lo3_pl_verblijfplaats(pl_id,volg_nr,inschrijving_gemeente_code) VALUES($1,$2,$3)                                                   | 9999,0,1999                 |