import { useAsukaStore } from '../store/asukaStore';

export function getPixabayApiKey(): string | null {
  const key = useAsukaStore.getState().integrations?.pixabay?.apiKey;
  return typeof key === 'string' && key.length > 0 ? key : null;
}


export function getPexelsApiKey(): string | null {
  const key = useAsukaStore.getState().integrations?.pexels?.apiKey;
  return typeof key === 'string' && key.length > 0 ? key : null;
}


export type FacebookIntegrationConfig = {
  appId: string;
  apiVersion: string;
  scopes: string;
};

export function getFacebookConfig(): FacebookIntegrationConfig | null {
  const cfg = useAsukaStore.getState().integrations?.facebook;
  const appId = (cfg?.appId ?? '').trim();
  if (!appId) return null;
  const apiVersion = (cfg?.apiVersion ?? 'v19.0').trim() || 'v19.0';
  const scopes = (cfg?.scopes ?? 'public_profile,user_photos').trim() || 'public_profile,user_photos';
  return { appId, apiVersion, scopes };
}
