consult occupancy within a period
#language: en 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 | 0800010000000001 | And address 'A2' has the following data | gemeentecode (92.10) | identificatiecode verblijfplaats (11.80) | | 0800 | 0800010000000002 | Rule: an occupancy can have several occupants and/or possible occupants Scenario: occupancy is requested for a period that falls within the period of stay of several persons at the addressable object Given 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 | 20100818 | 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 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 | 20200000 | And the person with citizen service number '000000072' is registered at address 'A1' with the following data | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) | | 0800 | 00000000 | When occupancy is searched with the following parameters | naam | waarde | | type | BewoningMetPeriode | | datumVan | 2020-01-01 | | datumTot | 2021-07-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | Then the response has an occupancy with the following data | naam | waarde | | periode | 2020-01-01 tot 2021-01-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | And the occupancy has occupants with the following data | burgerservicenummer | | 000000012 | | 000000024 | And the occupancy has possible occupants with the following data | burgerservicenummer | | 000000048 | | 000000072 | And the response has an occupancy with the following data | naam | waarde | | periode | 2021-01-01 tot 2021-07-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | And the occupancy has occupants with the following data | burgerservicenummer | | 000000012 | | 000000024 | | 000000048 | And the occupancy has possible occupants with the following data | burgerservicenummer | | 000000072 | 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 after the last stay Given 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 | When occupancy is searched with the following parameters | naam | waarde | | type | BewoningMetPeriode | | datumVan | 2020-01-01 | | datumTot | 2021-01-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | 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 Given 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 | 20200818 | When occupancy is searched with the following parameters | naam | waarde | | type | BewoningMetPeriode | | datumVan | 2020-01-01 | | datumTot | 2021-01-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | Then the response has an occupancy with the following data | naam | waarde | | periode | 2020-08-18 tot 2021-01-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | 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 within which a second occupant first comes to live there and the original occupant then leaves Given 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 | 20170818 | And the person was subsequently registered at address 'A2' with the following data | gemeente van inschrijving (09.10) | datum aanvang adreshouding (10.30) | | 0800 | 20201103 | 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 | 20200526 | When occupancy is searched with the following parameters | naam | waarde | | type | BewoningMetPeriode | | datumVan | 2020-01-01 | | datumTot | 2021-01-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | Then the response has an occupancy with the following data | naam | waarde | | periode | 2020-01-01 tot 2020-05-26 | | adresseerbaarObjectIdentificatie | 0800010000000001 | 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 | 2020-05-26 tot 2020-11-03 | | adresseerbaarObjectIdentificatie | 0800010000000001 | And the occupancy has occupants with the following data | burgerservicenummer | | 000000012 | | 000000024 | And the response has an occupancy with the following data | naam | waarde | | periode | 2020-11-03 tot 2021-01-01 | | adresseerbaarObjectIdentificatie | 0800010000000001 | And the occupancy has an occupant with the following data | burgerservicenummer | | 000000024 |