import { createContext, useContext, type ReactNode } from 'react'
import { useTenant, type TenantConfig } from '../hooks/useTenant'

const TenantContext = createContext<TenantConfig>({
  id: 1, slug: 'alemao', name: 'Alemão Conveniências',
  primary_color: '#f59e0b', secondary_color: '#10b981',
  logo_url: null, contact_email: null, contact_phone: null,
})

export function TenantProvider({ children }: { children: ReactNode }) {
  const tenant = useTenant()
  return <TenantContext.Provider value={tenant}>{children}</TenantContext.Provider>
}

export const useTenantCtx = () => useContext(TenantContext)
