

-- ── AD SLOTS ───────────────────────────────────────────────────────
INSERT INTO `{prefix}ad_slots` (`name`,`slug`,`description`,`pages`) VALUES
('Homepage Hero Top','homepage-hero','Above the fold, before calculator','["home"]'),
('After Calculator Results','after-results','Below result cards, high viewability','["home"]'),
('Sidebar Top (Sticky)','sidebar-top','Right sidebar, sticky top position','["home","blog"]'),
('Sidebar Bottom','sidebar-bottom','Right sidebar, bottom position','["home","blog"]'),
('13th Month — Top','calc-13th-top','Top of 13th month calculator','["13th-month"]'),
('13th Month — Mid','calc-13th-mid','After calculator, before guide','["13th-month"]'),
('13th Month — Bottom','calc-13th-bottom','End of page','["13th-month"]'),
('Freelancer Tax — Top','calc-free-top','Top of freelancer calculator','["freelancer"]'),
('Freelancer Tax — Mid','calc-free-mid','After results','["freelancer"]'),
('Freelancer Tax — Bottom','calc-free-bottom','End of page','["freelancer"]'),
('Compare Offers — Top','compare-top','Top of compare page','["compare"]'),
('Compare Offers — Mid','compare-mid','Between sections','["compare"]'),
('Compare Offers — After Results','compare-after','Below comparison results','["compare"]'),
('Blog Index — Top','blog-top','Top of blog listing','["blog"]'),
('Blog Index — Mid','blog-mid','Between categories and grid','["blog"]'),
('Blog Article — Top','article-top','Top of article, below breadcrumb','["article"]'),
('Blog Article — After Header','article-after-header','After article metadata','["article"]'),
('Blog Article — Before Related','article-before-related','Before related links','["article"]'),
('Mobile Sticky Footer','mobile-sticky','Fixed bottom mobile ad','["all"]'),
('404 Page','page-404','404 error page ad','["404"]');

-- ── FEATURE FLAGS ──────────────────────────────────────────────────
INSERT INTO `{prefix}feature_flags` (`name`,`slug`,`description`,`is_enabled`) VALUES
('Salary Calculator','salary-calculator','Main salary net pay calculator',1),
('13th Month Calculator','13th-month-calculator','13th month pay calculator',1),
('Freelancer Tax Calculator','freelancer-calculator','8% vs graduated rate calculator',1),
('Compare Job Offers','compare-calculator','Side-by-side job offer comparison',1),
('Blog System','blog','Blog articles and guides',1),
('SEO Sitemap','seo-sitemap','Auto XML sitemap generation',1),
('Maintenance Mode','maintenance-mode','Show maintenance page to visitors',0),
('Debug Mode','debug-mode','Enable error display and query log',0),
('API Access','api-access','REST API endpoint access',1),
('Newsletter','newsletter','Email subscriber system',1),
('Contact Form','contact-form','Contact page and email',1),
('Analytics Dashboard','analytics-dashboard','Internal analytics tracking',1),
('AI Search Optimization','aiso','AI/GEO optimizations in output',1),
('IndexNow Ping','indexnow','Auto-submit URLs to IndexNow on publish',1),
('WebP Auto-convert','webp-convert','Convert uploads to WebP',1),
('Lazy Load Images','lazy-load','Lazy load images sitewide',1);

-- ── SECURITY SETTINGS ──────────────────────────────────────────────
INSERT INTO `{prefix}security_settings` (`feature`,`is_enabled`,`config`,`risk_level`) VALUES
('firewall','1','{"mode":"active","log":true}','high'),
('rate_limiter','1','{"max":60,"window":60}','high'),
('bot_protection','1','{"block_known_bad":true,"log":true}','high'),
('brute_force','1','{"max_attempts":5,"lockout_minutes":15}','critical'),
('sql_injection_shield','1','{}','critical'),
('xss_protection','1','{}','critical'),
('csrf_protection','1','{}','critical'),
('csp_headers','1','{}','high'),
('hsts','1','{"max_age":31536000}','high'),
('clickjacking_protection','1','{"mode":"SAMEORIGIN"}','high'),
('directory_listing','1','{}','medium'),
('php_headers','1','{}','medium'),
('session_protection','1','{"regenerate":true,"encrypt":true}','high'),
('cookie_protection','1','{"secure":true,"httponly":true,"samesite":"Strict"}','high'),
('file_upload_protection','1','{"scan":true,"allowed_types":["jpg","png","gif","webp","pdf"]}','high'),
('two_factor_auth','0','{}','high'),
('login_captcha','0','{}','medium'),
('country_blocking','0','{"blocked_countries":[]}','low'),
('maintenance_mode','0','{}','low'),
('emergency_lockdown','0','{}','critical'),
('integrity_checker','1','{"check_interval":86400}','medium');

-- ── TAX RATES 2026 ─────────────────────────────────────────────────
INSERT INTO `{prefix}tax_rates` (`agency`,`name`,`rate_type`,`rate_data`,`effective_from`,`legal_basis`,`notes`,`is_active`) VALUES
('BIR','TRAIN Law Income Tax Brackets 2023+','bracket',
 '{"brackets":[{"min":0,"max":250000,"rate":0,"base":0},{"min":250001,"max":400000,"rate":0.15,"base":0},{"min":400001,"max":800000,"rate":0.20,"base":22500},{"min":800001,"max":2000000,"rate":0.25,"base":102500},{"min":2000001,"max":8000000,"rate":0.30,"base":402500},{"min":8000001,"max":null,"rate":0.35,"base":2202500}]}',
 '2023-01-01','RA 10963 (TRAIN Law)','TRAIN Law second tranche effective January 1, 2023. Annual brackets.',1),

('PhilHealth','PhilHealth Premium Rate 2026','percentage',
 '{"rate":0.05,"ee_share":0.025,"er_share":0.025,"min_salary":10000,"max_salary":100000,"min_premium":500,"max_premium":5000,"min_ee":250,"max_ee":2500}',
 '2023-01-01','PhilHealth Circular 2023-0014','5% of basic salary. Floor ₱10,000, ceiling ₱100,000.',1),

('SSS','SSS Contribution Schedule 2023','bracket',
 '{"total_rate":0.15,"ee_rate":0.05,"er_rate":0.101,"ec_low":10,"ec_high":30,"ec_threshold":14750,"min_msc":5000,"max_msc":35000,"wisp_threshold":20000,"brackets":[{"min":0,"max":5249.99,"msc":5000},{"min":5250,"max":5749.99,"msc":5500},{"min":5750,"max":6249.99,"msc":6000},{"min":6250,"max":6749.99,"msc":6500},{"min":6750,"max":7249.99,"msc":7000},{"min":7250,"max":7749.99,"msc":7500},{"min":7750,"max":8249.99,"msc":8000},{"min":8250,"max":8749.99,"msc":8500},{"min":8750,"max":9249.99,"msc":9000},{"min":9250,"max":9749.99,"msc":9500},{"min":9750,"max":10249.99,"msc":10000},{"min":10250,"max":10749.99,"msc":10500},{"min":10750,"max":11249.99,"msc":11000},{"min":11250,"max":11749.99,"msc":11500},{"min":11750,"max":12249.99,"msc":12000},{"min":12250,"max":12749.99,"msc":12500},{"min":12750,"max":13249.99,"msc":13000},{"min":13250,"max":13749.99,"msc":13500},{"min":13750,"max":14249.99,"msc":14000},{"min":14250,"max":14749.99,"msc":14500},{"min":14750,"max":15249.99,"msc":15000},{"min":15250,"max":15749.99,"msc":15500},{"min":15750,"max":16249.99,"msc":16000},{"min":16250,"max":16749.99,"msc":16500},{"min":16750,"max":17249.99,"msc":17000},{"min":17250,"max":17749.99,"msc":17500},{"min":17750,"max":18249.99,"msc":18000},{"min":18250,"max":18749.99,"msc":18500},{"min":18750,"max":19249.99,"msc":19000},{"min":19250,"max":19749.99,"msc":19500},{"min":19750,"max":20249.99,"msc":20000},{"min":20250,"max":20749.99,"msc":20500},{"min":20750,"max":21249.99,"msc":21000},{"min":21250,"max":21749.99,"msc":21500},{"min":21750,"max":22249.99,"msc":22000},{"min":22250,"max":22749.99,"msc":22500},{"min":22750,"max":23249.99,"msc":23000},{"min":23250,"max":23749.99,"msc":23500},{"min":23750,"max":24249.99,"msc":24000},{"min":24250,"max":24749.99,"msc":24500},{"min":24750,"max":25249.99,"msc":25000},{"min":25250,"max":25749.99,"msc":25500},{"min":25750,"max":26249.99,"msc":26000},{"min":26250,"max":26749.99,"msc":26500},{"min":26750,"max":27249.99,"msc":27000},{"min":27250,"max":27749.99,"msc":27500},{"min":27750,"max":28249.99,"msc":28000},{"min":28250,"max":28749.99,"msc":28500},{"min":28750,"max":29249.99,"msc":29000},{"min":29250,"max":29749.99,"msc":29500},{"min":29750,"max":30249.99,"msc":30000},{"min":30250,"max":30749.99,"msc":30500},{"min":30750,"max":31249.99,"msc":31000},{"min":31250,"max":31749.99,"msc":31500},{"min":31750,"max":32249.99,"msc":32000},{"min":32250,"max":32749.99,"msc":32500},{"min":32750,"max":33249.99,"msc":33000},{"min":33250,"max":33749.99,"msc":33500},{"min":33750,"max":34249.99,"msc":34000},{"min":34250,"max":34749.99,"msc":34500},{"min":34750,"max":null,"msc":35000}]}',
 '2023-01-01','RA 11199 (Social Security Act 2018), SSS Circular 2023-010','15% of MSC. Employee 5%, Employer ~10.1% + EC Fund.',1),

('PagIBIG','Pag-IBIG Contribution (Circular 460)','formula',
 '{"ee_rate":0.02,"er_rate":0.02,"min_rate_salary_threshold":1500,"low_ee_rate":0.01,"mfs_cap":10000,"max_ee":200,"max_er":200}',
 '2024-01-01','RA 9679, Pag-IBIG Circular No. 460 (2024)','MFS cap raised from ₱5,000 to ₱10,000 by Circular 460 in 2024.',1),

('GSIS','GSIS Contribution Rate','percentage',
 '{"ee_rate":0.09,"er_rate":0.12,"total_rate":0.21,"no_cap":true}',
 '1997-01-01','RA 8291 (GSIS Act of 1997)','9% employee, 12% government agency. No salary cap.',1),

('DOLE','Overtime Pay Rates','formula',
 '{"regular_ot":1.25,"rest_day":1.30,"rest_day_ot":1.30,"special_holiday":1.30,"special_holiday_ot":1.69,"regular_holiday":2.00,"regular_holiday_ot":2.60,"working_days_per_month":22,"hours_per_day":8}',
 '1974-01-01','PD 442 (Labor Code of the Philippines), Articles 87, 93, 94','Based on Philippine Labor Code overtime multipliers.',1),

('DOLE','13th Month Pay','formula',
 '{"formula":"total_basic_salary_year / 12","tax_exempt_limit":90000,"legal_deadline":"December 24","min_service_months":1}',
 '1975-01-01','Presidential Decree No. 851','Mandatory for all rank-and-file private sector employees. Tax exempt up to ₱90,000 (TRAIN Law).',1);

-- ── DEFAULT MENUS ──────────────────────────────────────────────────
INSERT INTO `{prefix}menus` (`name`,`location`) VALUES
('Header Navigation','header'),
('Footer Navigation','footer'),
('Mobile Navigation','mobile');

INSERT INTO `{prefix}menu_items` (`menu_id`,`parent_id`,`title`,`url`,`sort_order`) VALUES
(1,NULL,'Calculator','/',1),
(1,NULL,'13th Month','/13th-month-calculator',2),
(1,NULL,'Freelancer Tax','/freelancer-tax-calculator',3),
(1,NULL,'Compare','/compare-offers',4),
(1,NULL,'Blog','/blog',5);

-- ── DEFAULT CALCULATORS ────────────────────────────────────────────
INSERT INTO `{prefix}calculators` (`name`,`slug`,`description`,`type`,`is_active`,`sort_order`) VALUES
('Philippine Salary Calculator','salary','Compute monthly net take-home pay after PhilHealth, SSS, Pag-IBIG, and BIR TRAIN Law withholding tax.','salary',1,1),
('13th Month Pay Calculator','13th-month','Full-year, prorated, and month-by-month 13th month pay with ₱90,000 tax-free breakdown.','thirteenth',1,2),
('Freelancer Tax Calculator','freelancer-tax','Compare 8% flat rate vs graduated income tax for Philippine freelancers.','freelancer',1,3),
('Compare Job Offers','compare-offers','Side-by-side net pay comparison of two job offers with allowances and analytics.','compare',1,4);

-- ── CRON JOBS ──────────────────────────────────────────────────────
INSERT INTO `{prefix}cron_jobs` (`name`,`command`,`schedule`,`is_active`) VALUES
('Sitemap Generator','sitemap:generate','0 2 * * *',1),
('Cache Cleanup','cache:cleanup','0 */6 * * *',1),
('Security Scan','security:scan','0 3 * * *',1),
('Login Cleanup','auth:cleanup-attempts','0 4 * * *',1),
('Analytics Sync','analytics:sync','*/30 * * * *',1),
('Backup Database','backup:database','0 1 * * *',1),
('IndexNow Ping','seo:indexnow','*/5 * * * *',1),
('Expired Tokens Cleanup','auth:cleanup-tokens','0 5 * * *',1),
('Notification Cleanup','notifications:cleanup','0 6 * * 0',1);

-- ── DEFAULT SECURITY LOG ───────────────────────────────────────────
-- (empty, will be populated at runtime)
