HAALCENTRAAL English translation
BRP API / Bewoning / Features / bewoner-gba

consult occupancy within a period

#language: en

@gba
Feature: consult occupancy within a period

  As a consumer of the Bewoning API
  I want to be able to request which persons stay or stayed at an addressable object within a period
  so that I can use this information in my process

  Background:
    Given address 'A1' has the following data
    | gemeentecode (92.10) | identificatiecode verblijfplaats (11.80) |
    | 0800                 | 0800000000000001                         |
    And address 'A2' has the following data
    | gemeentecode (92.10) | identificatiecode verblijfplaats (11.80) |
    | 0800                 | 0800000000000002                         |
    And the person with citizen service number '000000024' is registered at address 'A1' with the following data
    | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) |
    | 0800                              | 20100818                           |
    And the person was subsequently registered at address 'A2' with the following data
    | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) |
    | 0800                              | 20160526                           |
    And the 'verblijfplaats' has been changed to the following data
    | land (13.10) | datum aanvang adres buitenland (13.20) | regel 1 adres buitenland (13.30) | regel 2 adres buitenland (13.40) | regel 3 adres buitenland (13.50) |
    | 5010         | 20230526                               | Rue du pomme 26                  | Bruxelles                        | postcode 1000                    |
    And the person with citizen service number '000000048' is registered at address 'A1' with the following data
    | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) |
    | 0800                              | 20140808                           |
    And the person with citizen service number '000000012' is registered at address 'A2' with the following data
    | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) |
    | 0800                              | 20081103                           |
    And the 'verblijfplaats' has been changed to the following data
    | land (13.10) | datum aanvang adres buitenland (13.20) | regel 1 adres buitenland (13.30) | regel 2 adres buitenland (13.40) | regel 3 adres buitenland (13.50) |
    | 5010         | 20160428                               | Rue des poires 36                | Bruxelles                        | postcode 1000                    |

Rule: a person is an occupant of an addressable object within a period where:
      - the from date of the period falls on or after the start date of the address occupancy of the person at the addressable object
      - the to date of the period falls before the start date of the address occupancy of the person at the next addressable object

  Scenario: occupancy is requested for a period that falls within the period of stay of one person at the addressable object
    When gba occupancy is searched with the following parameters
    | naam                             | waarde             |
    | type                             | BewoningMetPeriode |
    | datumVan                         | 2010-09-01         |
    | datumTot                         | 2014-08-01         |
    | adresseerbaarObjectIdentificatie | 0800000000000001   |
    Then the response has an occupancy with the following data
    | naam                             | waarde                    |
    | periode                          | 2010-09-01 tot 2014-08-01 |
    | adresseerbaarObjectIdentificatie | 0800000000000001          |
    And the occupancy has an occupant with the following data
    | burgerservicenummer |
    | 000000024           |

  Scenario: occupancy is requested for a period that falls within the period of stay of several persons at the addressable object
    When gba occupancy is searched with the following parameters
    | naam                             | waarde             |
    | type                             | BewoningMetPeriode |
    | datumVan                         | 2014-09-01         |
    | datumTot                         | 2016-05-26         |
    | adresseerbaarObjectIdentificatie | 0800000000000001   |
    Then the response has an occupancy with the following data
    | naam                             | waarde                    |
    | periode                          | 2014-09-01 tot 2016-05-26 |
    | adresseerbaarObjectIdentificatie | 0800000000000001          |
    And the occupancy has occupants with the following data
    | burgerservicenummer |
    | 000000024           |
    | 000000048           |

Rule: no occupancy is supplied for a period requested for an addressable object where no persons stay or stayed at the addressable object within that period

  Scenario: occupancy is requested for a period that falls before the period of stay of a person at the addressable object
    When gba occupancy is searched with the following parameters
    | naam                             | waarde             |
    | type                             | BewoningMetPeriode |
    | datumVan                         | 2010-01-01         |
    | datumTot                         | 2010-08-17         |
    | adresseerbaarObjectIdentificatie | 0800000000000001   |
    Then the response has 0 occupancies

Rule: no occupancy is supplied for part of the period requested for an addressable object where no persons stay or stayed at the addressable object within that part of the period

  Scenario: occupancy is requested for a period that falls partly before the period of stay of a person at the addressable object
    When gba occupancy is searched with the following parameters
    | naam                             | waarde             |
    | type                             | BewoningMetPeriode |
    | datumVan                         | 2010-01-01         |
    | datumTot                         | 2011-01-01         |
    | adresseerbaarObjectIdentificatie | 0800000000000001   |
    Then the response has an occupancy with the following data
    | naam                             | waarde                    |
    | periode                          | 2010-08-18 tot 2011-01-01 |
    | adresseerbaarObjectIdentificatie | 0800000000000001          |
    And the occupancy has an occupant with the following data
    | burgerservicenummer |
    | 000000024           |

  Scenario: occupancy is requested for a period within which the addressable object was temporarily unoccupied
    When gba occupancy is searched with the following parameters
    | naam                             | waarde             |
    | type                             | BewoningMetPeriode |
    | datumVan                         | 2016-01-01         |
    | datumTot                         | 2017-01-01         |
    | adresseerbaarObjectIdentificatie | 0800000000000002   |
    Then the response has an occupancy with the following data
    | naam                             | waarde                    |
    | periode                          | 2016-01-01 tot 2016-04-28 |
    | adresseerbaarObjectIdentificatie | 0800000000000002          |
    And the occupancy has an occupant with the following data
    | burgerservicenummer |
    | 000000012           |
    And the response has an occupancy with the following data
    | naam                             | waarde                    |
    | periode                          | 2016-05-26 tot 2017-01-01 |
    | adresseerbaarObjectIdentificatie | 0800000000000002          |
    And the occupancy has an occupant with the following data
    | burgerservicenummer |
    | 000000024           |

Rule: several occupancies are supplied for a period for an addressable object where the composition of the occupants changes within the period requested

  Scenario: occupancy is requested for a period that falls within the period of stay of one person and partly within the period of stay of another person at the addressable object
    When gba occupancy is searched with the following parameters
    | naam                             | waarde             |
    | type                             | BewoningMetPeriode |
    | datumVan                         | 2014-01-01         |
    | datumTot                         | 2016-05-01         |
    | adresseerbaarObjectIdentificatie | 0800000000000001   |
    Then the response has an occupancy with the following data
    | naam                             | waarde                    |
    | periode                          | 2014-01-01 tot 2014-08-08 |
    | adresseerbaarObjectIdentificatie | 0800000000000001          |
    And the occupancy has an occupant with the following data
    | burgerservicenummer |
    | 000000024           |
    And the response has an occupancy with the following data
    | naam                             | waarde                    |
    | periode                          | 2014-08-08 tot 2016-05-01 |
    | adresseerbaarObjectIdentificatie | 0800000000000001          |
    And the occupancy has occupants with the following data
    | burgerservicenummer |
    | 000000024           |
    | 000000048           |