PRAGMA foreign_keys = ON;

INSERT OR IGNORE INTO wm_users (
  id, username, email, display_name, avatar_key, bio, url, password_hash, role, status, created_at, updated_at
) VALUES
('01HX0000000000000000000001', 'admin', 'admin@example.com', '站长', 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=160&h=160&fit=crop', '微记管理员', 'https://example.com', 'scrypt$N=32768$r=8$p=1$pT39RV7rl+/uC7eeXS/viQ==$HeNplSUs83G/F6Qd5SjxNiWCv3syz2THDV7k8q5auuk=', 'admin', 'active', strftime('%s','now','-10 days'), strftime('%s','now','-10 days')),
('01HX0000000000000000000002', 'alice', 'alice@example.com', 'Alice', 'https://images.unsplash.com/photo-1508214751196-bcfd4ca60f91?w=160&h=160&fit=crop', '喜欢记录日常。', '', 'scrypt$N=32768$r=8$p=1$RsoJ6b1ZitYSPHIN5RJUlg==$bm9tmEOJBRewEcC2SZ0ZaovK2QV2goMgwiwKraNcSUk=', 'author', 'active', strftime('%s','now','-9 days'), strftime('%s','now','-9 days')),
('01HX0000000000000000000003', 'bob', 'bob@example.com', 'Bob', 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=160&h=160&fit=crop', '路过世界。', '', 'scrypt$N=32768$r=8$p=1$YqR8nZrCPMUymVssSimbxw==$w8rDznYwviUIZ+mZPERTi4lw7i86UC+aJGGh2lCYHaU=', 'subscriber', 'active', strftime('%s','now','-8 days'), strftime('%s','now','-8 days'));

INSERT OR REPLACE INTO wm_settings(key, value) VALUES
('site_name', '"微记"'),
('site_description', '"像朋友圈一样记录生活"'),
('comment_mode', '"registered"'),
('allow_register', 'true'),
('default_role', '"subscriber"');

INSERT OR IGNORE INTO wm_posts (
  id, author_id, type, visibility, status, is_top, is_ad, title, content, content_html, video_key, position, position_lat, position_lng, share_url, share_thumb, created_at, updated_at
) VALUES
('01HXPOST000000000000000001', '01HX0000000000000000000001', 'moment', 'public', 'published', 1, 0, '', '第一条微记上线了。欢迎把这里当作自己的小朋友圈。', '第一条微记上线了。欢迎把这里当作自己的小朋友圈。', NULL, '上海·静安', 31.2304, 121.4737, NULL, NULL, strftime('%s','now','-2 hours'), strftime('%s','now','-2 hours')),
('01HXPOST000000000000000002', '01HX0000000000000000000002', 'moment', 'public', 'published', 0, 0, '', '午后散步，天气很好。', '午后散步，天气很好。', NULL, '杭州·西湖', 30.2460, 120.1500, NULL, NULL, strftime('%s','now','-1 day'), strftime('%s','now','-1 day')),
('01HXPOST000000000000000003', '01HX0000000000000000000003', 'moment', 'public', 'published', 0, 0, '', '九宫格测试。', '九宫格测试。', NULL, '成都·太古里', 30.6570, 104.0800, NULL, NULL, strftime('%s','now','-3 days'), strftime('%s','now','-3 days')),
('01HXPOST000000000000000004', '01HX0000000000000000000001', 'article', 'public', 'published', 0, 1, '微记部署指南', 'Cloudflare Workers + D1 + R2 可以支撑一个完整的小型内容站。', 'Cloudflare Workers + D1 + R2 可以支撑一个完整的小型内容站。', NULL, NULL, NULL, NULL, 'https://developers.cloudflare.com/workers/', 'https://images.unsplash.com/photo-1558494949-ef010cbdcc31?w=300&h=200&fit=crop', strftime('%s','now','-5 days'), strftime('%s','now','-5 days'));

INSERT OR IGNORE INTO wm_post_images(post_id, position, r2_key, width, height) VALUES
('01HXPOST000000000000000002', 0, 'https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000002', 1, 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000002', 2, 'https://images.unsplash.com/photo-1500534314209-a25ddb2bd429?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 0, 'https://images.unsplash.com/photo-1493246507139-91e8fad9978e?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 1, 'https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 2, 'https://images.unsplash.com/photo-1500534314209-a25ddb2bd429?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 3, 'https://images.unsplash.com/photo-1500534314209-a25ddb2bd429?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 4, 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 5, 'https://images.unsplash.com/photo-1519681393784-d120267933ba?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 6, 'https://images.unsplash.com/photo-1519681393784-d120267933ba?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 7, 'https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=720&h=720&fit=crop', 720, 720),
('01HXPOST000000000000000003', 8, 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=720&h=720&fit=crop', 720, 720);

INSERT OR IGNORE INTO wm_comments (
  id, post_id, parent_id, user_id, guest_name, guest_email, guest_url, content, status, ip, user_agent, created_at
) VALUES
('01HXCOMM000000000000000001', '01HXPOST000000000000000001', NULL, '01HX0000000000000000000002', NULL, NULL, NULL, '很像朋友圈的感觉。', 'approved', '127.0.0.1', 'seed', strftime('%s','now','-90 minutes')),
('01HXCOMM000000000000000002', '01HXPOST000000000000000001', '01HXCOMM000000000000000001', '01HX0000000000000000000001', NULL, NULL, NULL, '后面继续完善。', 'approved', '127.0.0.1', 'seed', strftime('%s','now','-80 minutes')),
('01HXCOMM000000000000000003', '01HXPOST000000000000000002', NULL, '01HX0000000000000000000003', NULL, NULL, NULL, '照片很好看。', 'approved', '127.0.0.1', 'seed', strftime('%s','now','-20 hours'));

INSERT OR IGNORE INTO wm_likes(post_id, user_id, created_at) VALUES
('01HXPOST000000000000000001', '01HX0000000000000000000002', strftime('%s','now','-85 minutes')),
('01HXPOST000000000000000001', '01HX0000000000000000000003', strftime('%s','now','-82 minutes')),
('01HXPOST000000000000000002', '01HX0000000000000000000001', strftime('%s','now','-19 hours'));

INSERT OR IGNORE INTO wm_links(id, name, url, avatar, description, category, visible, sort_order, created_at) VALUES
('01HXLINK000000000000000001', 'Cloudflare Workers', 'https://developers.cloudflare.com/workers/', 'https://www.cloudflare.com/favicon.ico', '边缘运行时', 'docs', 1, 1, strftime('%s','now','-7 days')),
('01HXLINK000000000000000002', 'Hono', 'https://hono.dev/', 'https://hono.dev/images/logo-small.png', 'Web framework', 'docs', 1, 2, strftime('%s','now','-7 days'));

-- Demo accounts:
-- admin / admin12345
-- alice / alice12345
-- bob / bob12345
