-- SQL statements which are executed at application startup if hibernate.hbm2ddl.auto is 'create' or 'create-drop'
INSERT INTO app_configuration(id, variable, value) VALUES (1,'application_url','http://localhost:8080/PDQPDSSimulator/');
INSERT INTO app_configuration(id, variable, value) VALUES (2,'pds_server_port','3603');
INSERT INTO app_configuration(id, variable, value) VALUES (3,'dds_web_service','http://131.254.209.12:8080/DDS-prod-DemographicDataServer-ejb/DemographicDataServerBean?wsdl');
INSERT INTO app_configuration(id, variable, value) VALUES (4, 'application_admin_email', 'eric.poiseau@inria.fr');
INSERT INTO app_configuration(id, variable, value) VALUES (5, 'application_issue_tracker_url', 'http://gazelle.ihe.net/jira/');
INSERT INTO app_configuration(id, variable, value) VALUES (6, 'application_name', 'PDQ PDS Simulator');
INSERT INTO app_configuration(id, variable, value) VALUES (7, 'application_release_notes_url', 'http://gazelle.ihe.net');
INSERT INTO app_configuration(id, variable, value) VALUES (8, 'application_time_zone', 'UTC+01');
INSERT INTO app_configuration(id, variable, value) VALUES (9, 'application_admin_name', 'Eric Poiseau');
INSERT INTO app_configuration(id, variable, value) VALUES (10, 'openempi_db', 'openempi');
INSERT INTO app_configuration(id, variable, value) VALUES (11, 'sending_application', 'PDSSimulator');
INSERT INTO app_configuration(id, variable, value) VALUES (12, 'sending_facility', 'IHE');
INSERT INTO app_configuration(id, variable, value) VALUES (14, 'hl7_version', '2.5');
INSERT INTO app_configuration(id, variable, value) VALUES (15, 'number_of_segments_to_trunk', '50');

INSERT INTO app_configuration(id, variable, value) VALUES (13, 'xsl_location', 'http://gazelle.ihe.net/xsl/hl7Validation/resultStylesheet.xsl');

SELECT pg_catalog.setval('app_configuration_id_seq', 12, true);

-- admin password is blank
insert into user_account (id, username, password_hash, enabled) values (1, 'admin', 'Ss/jICpf9c9GeJj8WKqx1hUClEE=', true);
insert into user_role (id, name, conditional) values (1, 'admin', false);
insert into user_role (id, name, conditional) values (2, 'member', false);
insert into user_role (id, name, conditional) values (3, 'guest', true);
insert into user_account_role (account_id, member_of_role) values (1, 1);
insert into user_role_group (role_id, member_of_role) values (1, 2);

SELECT pg_catalog.setval('user_account_id_seq', 1, true);
SELECT pg_catalog.setval('user_role_id_seq', 3, true);

-- transaction definition
INSERT INTO tf_transaction(id, description, keyword, name) VALUES (1, 'ITI-21', 'ITI-21', 'ITI-21');
SELECT pg_catalog.setval('tf_transaction_id_seq', 1, true);

INSERT INTO tf_actor(id, description, keyword, name) VALUES (1, 'PDC', 'Patient demographic consumer', null);
INSERT INTO tf_actor(id, description, keyword, name) VALUES (2, 'PDS', 'Patient demographic supplier', null);
SELECT pg_catalog.setval('tf_actor_id_seq', 1, true);

INSERT INTO "validation_parameters" (id, message_type, actor_id, transaction_id, profile_oid) VALUES ('1', 'QBP^Q22^QBP_Q21', 1, 1, '1.3.6.1.4.12559.11.1.1.31');
INSERT INTO "validation_parameters" (id, message_type, actor_id, transaction_id, profile_oid) VALUES ('2', 'RSP^K22^RSP_K22', 2,  1,'1.3.6.1.4.12559.11.1.1.35');
