insert into account_t (description) values ('account testtenant1');

insert into tenant_t (lastname, account) values (
    'testtenant1', 
    (select id from account_t where description = 'account testtenant1')
);

insert into premise_t (street, zip, city) values ('Hemsingskotten 38', '45259', 'Essen');

insert into parking_t (description, premise) values ('Garage 1', (select id from premise_t where street = 'Hemsingskotten 38'));

insert into flat_t (description, premise, area, flat_no) values('EG links', (select id from premise_t where street = 'Hemsingskotten 38'), 59.0, 1);

insert into fee_t (description, amount, fee_type, startdate) values ('Altenwohnung Hemsingskotten', 5.23, 'per_area', '2021-01-01');

insert into fee_t (description, amount, fee_type, startdate) values ('Garage intern', 30.0, 'total', '2021-01-01');

insert into tenancy_t (tenant, flat, description, startdate) values (
    (select id from tenant_t where lastname = 'testtenant1'),
    (select id from flat_t where flat_no = 1),
    'flat testtenant1',
    '2021-06-01'
);

insert into tenancy_t (tenant, parking, description, startdate) values (
    (select id from tenant_t where lastname = 'testtenant1'),
    (select id from parking_t where description = 'Garage 1'),
    'parking testtenant1',
    '2021-06-01'
);

insert into overhead_advance_t (description, amount, startdate) values ('BKV Altenwohnung Hemsingskotten', 0.34, '2021-01-01');

insert into overhead_advance_flat_mapping_t (overhead_advance, flat) values (
    (select id from overhead_advance_t where description = 'BKV Altenwohnung Hemsingskotten'),
    (select id from flat_t where flat_no = 1)
);

insert into tenancy_fee_mapping_t (tenancy, fee) values (
    (select id from tenancy_t where description = 'flat testtenant1'),
    (select id from fee_t where description = 'Altenwohnung Hemsingskotten')
);

insert into tenancy_fee_mapping_t (tenancy, fee) values (
    (select id from tenancy_t where description = 'parking testtenant1'),
    (select id from fee_t where description = 'Garage intern')
);

