USE caresoft_vms;

INSERT INTO plans (code,name,max_gates,max_users,max_visits_day,allow_caresoft,allow_photo,allow_api,price_year) VALUES
('LITE','Lite',2,10,500,0,1,0,45000),
('PRO','Professional',6,40,3000,1,1,1,120000),
('ENT','Enterprise',50,500,50000,1,1,1,350000);

-- Demo client
INSERT INTO clients (client_code,name,legal_name,hospital_type,bed_count,city,state,pincode,
  contact_person,contact_email,contact_mobile,plan_id,valid_from,valid_to,status)
VALUES ('VMS-DEMO','Demo Multispeciality Hospital','Demo Healthcare Pvt Ltd','Multi-speciality',180,
  'Mumbai','Maharashtra','400107','Admin','admin@demo.in','9800000000',2,
  CURDATE(), DATE_ADD(CURDATE(), INTERVAL 1 YEAR),'active');

SET @c := LAST_INSERT_ID();

INSERT INTO caresoft_integration (client_id,enabled,base_url,hospital_code) VALUES (@c,0,'','');

INSERT INTO client_settings (client_id,skey,svalue) VALUES
(@c,'pass_prefix','VP'),
(@c,'default_pass_minutes','120'),
(@c,'require_photo','0'),
(@c,'require_id_proof','0'),
(@c,'otp_channel','whatsapp'),
(@c,'otp_length','6'),
(@c,'otp_validity_min','10'),
(@c,'max_visitors_per_patient','2'),
(@c,'visiting_hours','11:00-12:00, 17:00-19:00'),
(@c,'consent_text','I confirm the details are correct and agree to follow hospital visiting rules and infection-control guidelines.'),
(@c,'support_mobile','9800000000');

INSERT INTO departments (client_id,dept_code,dept_name,dept_type,floor_name,max_visitors) VALUES
(@c,'GW1','General Ward - 1','ward','1st Floor',2),
(@c,'ICU1','Medical ICU','icu','2nd Floor',1),
(@c,'MAT','Maternity Ward','ward','3rd Floor',2),
(@c,'PVT','Private Rooms','ward','4th Floor',3);

INSERT INTO doctors (client_id,doc_code,doc_name,speciality) VALUES
(@c,'D001','Dr. A. Sharma','General Medicine'),
(@c,'D002','Dr. R. Nair','Cardiology'),
(@c,'D003','Dr. S. Iyer','Obstetrics');

INSERT INTO purposes (client_id,purpose_name,needs_patient,pass_minutes,sort_order) VALUES
(@c,'Visit an admitted patient',1,60,1),
(@c,'Patient attendant (bystander)',1,720,2),
(@c,'OPD / consultation escort',1,180,3),
(@c,'Meet hospital staff',0,60,4),
(@c,'Vendor / supplier',0,120,5),
(@c,'Interview / official',0,120,6);

INSERT INTO content_blocks (client_id,slot,title,body_html,sort_order) VALUES
(@c,'signup_top','Welcome to Demo Multispeciality Hospital',
 '<p>Please register to receive your visitor gate pass. Verification takes about 30 seconds.</p>',1),
(@c,'signup_bottom','Free Diabetes Screening Camp - every Saturday',
 '<p>Walk in between 9 AM and 1 PM at OPD Block B. Free HbA1c for patients above 40. Ask at the help desk.</p>',1),
(@c,'signup_bottom','Infection control: 5 moments of hand hygiene',
 '<p>Sanitise your hands before entering and after leaving the ward. Masks are mandatory in ICU and post-operative areas.</p>',2),
(@c,'pass_footer',NULL,
 '<p>Show this pass at the gate. One pass is valid for one visitor only. Please return the pass while leaving.</p>',1),
(@c,'thankyou','Thank you',
 '<p>Your pass has been issued. Keep this screen open or take a screenshot.</p>',1);
