

insert into cinemas(name,location) values  
('Plex','CityMall'),
('Kinoteka','MKC'),
('Kino Karpos','Karposh');

insert into workers(ID_worker,position,work_hours_from,work_hours_to,ID_cinema) values 
(1,'cleaner','8','17',2),
(2,'cashier','8','17',3),
(3,'menager','9','18',1);

insert into customers(ID_customer) values 
(4),(5),(6),(7);

insert into salaries(sum,ID_worker,date_from) values 
(20000,1,now()),
(33000,2,now()),
(40000,3,now());

insert into films(name,duration,actors,genre,age_category,director,start_date,end_date) values 
('The ShawshankRedemption',142,'Tim Robbins,Morgan Freeman','drama','R','Frank Darabont',now(),now()+interval'2 months'),
('The Godfather',175,'Marlon Brando, Al Pacino','crime,drama','R','Francis Ford Coppola',now(),now()+interval'2 weeks'),
('The Dark Knight',152,'Christian Bale,Heath Ledger','action,crime,drama','PG-13','Christopher Nolan',now(),now()+interval'2 months'),
('Pulp Fiction',154,'Jhon Travolta,Uma Thurman','crime,drama','R','Quentin Tarantino',now(),now()+interval'1 months'),
('The Lord of the Rings:The Fellowship of the Ring',178,'Elijah Wood,Ian McKellen,Orlando Bloom','action,adventture,drama','PG-13','Peter Jackson',now(),now()+interval'2 months');

insert into events(theme,duration,repeating,start_date) values 
('birthday',120,'no',now()),
('Marvel Marathon',360,'no',now()),
('Ladies Night',120,'every week',now());

insert into discounts(validity,code,type,percent) values 
(now()+interval '1 month','DFL2','student',20),
(now()+interval '2 months','MARVEL','everyone',10),
(now()+interval '3 weeks','KKLOP','everyone',5);

insert into projections(date_time_start,type_of_technology,date_time_end,ID_film,ID_discount,ID_event) values
(now(),'3D',now()+interval '2 hours 22 minutes',1,3,null),
(now()+interval '1 week','2D',now()+interval '2 hours 55 minutes',2,null,null),
(now()-interval '1 week','2D',now()+interval '2 hours 32 minutes',3,1,null),
(now(),'3D',now()+interval '2 hours 22 minutes',3,3,3),
(now()+interval '2 week','2D',now()+interval '2 hours 55 minutes',2,null,null),
(now()-interval '2 week 1 day','2D',now()+interval '2 hours 32 minutes',3,1,null),
(now()+interval '3 days','3D',now()+interval '2 hours 34 minutes',4,3,null),
(now()+interval '1 week','2D',now()+interval '2 hours 58 minutes',5,1,null),
(now()-interval '1 week','2D',now()+interval '2 hours 58 minutes',5,3,1);

insert into projection_rooms(number_of_seats,projection_room_number,ID_cinema) values
(30,1,1),
(35,2,1),
(50,3,1),
(55,4,1),
(40,1,2),
(60,2,2),
(20,3,2),
(52,1,3),
(54,2,3),
(65,3,3);

insert into categories(name,extra_amount) values
('love seats',50),
('disablility',0),
('no category',0),
('vip',200);

insert into seats(seat_number,ID_room,ID_category) values
(22,1,3),(15,1,3),(23,1,3),(16,1,1),(13,1,3),(14,1,2),(21,1,4),
(22,2,1),(15,2,3),(1,2,2),(16,2,3),(24,2,3),(30,2,4);

insert into tickets(price,date_reserved,ID_customer,ID_projection,ID_seat) values
(350,now(),4,3,2),
(450,now()-interval'1 week',7,1,3),
(350,now()-interval'2 days',5,2,5),
(250,now()-interval'4 days',6,3,6);

insert into project.customer_rates_film (ID_customer,ID_film,rating) values 
(4,1,5),
(5,2,4.5),
(6,3,3);

insert into project.cinema_plays_film(ID_cinema,ID_film) values 
(1,1),(2,1),(3,1),(2,2),(2,3),(2,4),(3,5),(3,2);

insert into project.cinema_organizes_event(ID_cinema,id_event) values 
(1,2),(2,2),(3,3);

insert into project.projection_is_played_in_room(ID_projection,ID_room) values 
(1,1),(2,3),(4,3),(5,5);

insert into customer_is_interested_in_event(id_customer,id_event) values
(4,1),(4,2),(5,1),(5,3),(6,2);

insert into work_hours_weekly(id_worker,week_number,year_num,hours_from,hours_to) values 
(1,to_char(now(),'WW')::int,extract(year from now()),to_timestamp('08:00','HH24:MI'),to_timestamp('16:00','HH24:MI')),
(1,to_char(now()+interval '1 week','WW')::int,extract(year from now()+interval '1 week'),to_timestamp('16:00','HH24:MI'),to_timestamp('00:00','HH24:MI')),
(1,to_char(now()+interval '2 week','WW')::int,extract(year from now()+interval '2 week'),to_timestamp('00:00','HH24:MI'),to_timestamp('04:00','HH24:MI'));
