-- Local-only seed users. Password for both accounts: FieldOps123
INSERT INTO tenants (id,name,slug,trade_type,region,status,created_at,updated_at) VALUES
(1,'Owner Trade Co','owner-trade-co','Multi-trade contractor','United Kingdom','active',NOW(),NOW()),
(2,'Demo Trade Co','demo-trade-co','Multi-trade contractor','United Kingdom','trialing',NOW(),NOW());

INSERT INTO subscription_plans (plan_key,name,price_monthly,included_seats,job_limit,ai_credits,storage_gb,features,status,created_at,updated_at) VALUES
('starter','Starter',49.00,2,75,50,5,JSON_ARRAY('jobs','clients','quotes','invoices','csv_import_export'),'active',NOW(),NOW()),
('growth','Growth',129.00,8,300,250,25,JSON_ARRAY('jobs','clients','quotes','invoices','schedule_optimizer','customer_portal','accounting_integrations','csv_import_export'),'active',NOW(),NOW()),
('scale','Scale',299.00,25,1200,1000,100,JSON_ARRAY('jobs','clients','quotes','invoices','schedule_optimizer','customer_portal','accounting_integrations','advanced_reports','api_access','csv_import_export'),'active',NOW(),NOW());

INSERT INTO tenant_subscriptions (tenant_id,plan_key,status,billing_provider,external_customer_id,trial_ends_at,created_at,updated_at) VALUES
(1,'growth','active','manual_platform_billing',NULL,NULL,NOW(),NOW()),
(2,'growth','trialing','manual_platform_billing',NULL,DATE_ADD(NOW(), INTERVAL 14 DAY),NOW(),NOW());

INSERT INTO calendar_connections (tenant_id,provider_key,external_account_id,external_calendar_id,display_name,sync_direction,status,scopes,connected_by_user_id,created_at,updated_at) VALUES
(2,'google_calendar','ops@example.test','primary','Operations dispatch calendar','two_way','pending_oauth','https://www.googleapis.com/auth/calendar.events',2,NOW(),NOW()),
(2,'outlook_calendar','dispatch@example.test','default','Service team calendar','two_way','pending_oauth','offline_access Calendars.ReadWrite',2,NOW(),NOW());

INSERT INTO llm_connections (tenant_id,provider_key,display_name,model,endpoint_url,status,connected_by_user_id,created_at,updated_at) VALUES
(2,'openai','Import mapping assistant','gpt-4.1-mini',NULL,'not_connected_in_demo',2,NOW(),NOW());

INSERT INTO users (tenant_id,email,password_hash,role,name,phone,status,created_at,updated_at) VALUES
(1,'owner@example.test','$2y$10$KJx6mK3eVvM7r9E7nJ1nT.8f8W1QZbV6Y1uW3lWcHkzv2vWjDq0nG','owner','Owner User','','active',NOW(),NOW()),
(2,'demo@example.test','$2y$10$KJx6mK3eVvM7r9E7nJ1nT.8f8W1QZbV6Y1uW3lWcHkzv2vWjDq0nG','demo_user','Demo User','','active',NOW(),NOW());
