export interface Post {
  id: string;
  slug: string;
  title: string;
  description: string;
  content?: string;
  date: string;
  createdAt?: string;
  updatedAt?: string;
  readTime: string;
  type: 'article' | 'tweet';
  tags: string[];
  category: string;
  image?: string;
  images?: string[];
  code?: string;
  language?: string;
  pinned?: boolean;
  status?: string;
  visibility?: 'public' | 'unlisted' | 'private' | string;
  publishAt?: string;
  unpublishAt?: string;
  canonicalUrl?: string;
  noindex?: boolean;
  ogImage?: string;
  redirectFrom?: string[];
  redirectTo?: string;
}

export interface Category {
  id: string;
  name: string;
  slug: string;
  description?: string;
  coverImage?: string;
  accentColor?: string;
  seoTitle?: string;
  seoDescription?: string;
  icon?: string;
  count?: number;
}

export interface Tag {
  id: string;
  name: string;
  slug: string;
  description?: string;
  coverImage?: string;
  accentColor?: string;
  seoTitle?: string;
  seoDescription?: string;
  count?: number;
}

export interface FriendLink {
  id: string;
  name: string;
  url: string;
  avatar?: string;
  description?: string;
  category?: string;
}

export type HumanVerificationMode = 'off' | 'captcha' | 'turnstile';

export interface SiteSettings {
  id: string;
  siteName: string;
  siteShortName: string;
  siteUrl: string;
  siteTitle: string;
  siteDescription: string;
  heroTitle: string;
  heroSubtitle: string;
  ownerName: string;
  ownerTitle: string;
  ownerBio: string;
  ownerAvatarUrl?: string;
  location?: string;
  social: {
    github?: string;
    twitter?: string;
    email?: string;
  };
  techStack: string[];
  musicPlaylist: MusicTrack[];
  musicEnabled: boolean;
  ai: {
    enabled: boolean;
  };
  comments: {
    paragraphsEnabled: boolean;
    verificationMode: HumanVerificationMode;
    turnstileEnabled: boolean;
    turnstileSiteKey?: string;
  };
  subscriptions: {
    popupEnabled: boolean;
    popupTitle: string;
    popupDescription: string;
    popupDelaySeconds: number;
    verificationMode: HumanVerificationMode;
    turnstileEnabled: boolean;
    turnstileSiteKey?: string;
    webPushEnabled: boolean;
    webPushVapidPublicKey?: string;
  };
  seo: {
    faviconUrl?: string;
    defaultOgImage?: string;
    defaultTwitterHandle?: string;
    wechatShareQrEnabled: boolean;
  };
}

export interface MusicTrack {
  title: string;
  artist?: string;
  album?: string;
  url: string;
  coverImageUrl?: string;
  accentColor?: string;
  description?: string;
}

export interface SiteConfig {
  name: string;
  description: string;
  author: string;
  url: string;
  social: {
    github?: string;
    twitter?: string;
    email?: string;
  };
}

export interface SystemStat {
  label: string;
  value: string;
  icon?: string;
}

export interface TechStackItem {
  name: string;
  icon?: string;
  level?: string;
}

export interface ContentOverview {
  totalPageViews: number;
  pageViewsLast24h: number;
  pageViewsLast7d: number;
  totalReadCompletes: number;
  readCompletesLast7d: number;
  avgReadProgressLast7d: number;
  avgReadDurationMsLast7d?: number;
}

export interface PopularPostHighlight {
  slug: string;
  title: string;
  pageViews: number;
  readCompletes: number;
  avgProgressPercent: number;
  avgDurationMs?: number;
  post?: Post;
}

export interface ContentWindowOverview {
  pageViews: number;
  readCompletes: number;
  avgReadProgress: number;
  avgReadDurationMs?: number;
}

export interface ContentWindowHighlight {
  key: string;
  label: string;
  days: number;
  overview: ContentWindowOverview;
  popularPosts: PopularPostHighlight[];
}
