import { CONTENT_RESOURCES } from '../../config/contentResources'
import { contentHooks } from '../../api/apiContent'
import { ContentListPage } from './ContentListPage'
import { ContentEditPage } from './ContentEditPage'

const bind = (resourceKey) => {
  const config = CONTENT_RESOURCES[resourceKey]
  const hooks = contentHooks[resourceKey]

  return {
    ListPage: () => <ContentListPage config={config} hooks={hooks} />,
    EditPage: () => <ContentEditPage config={config} hooks={hooks} isCreate={false} />,
    CreatePage: () => <ContentEditPage config={config} hooks={hooks} isCreate />,
  }
}

const news = bind('news')
const promo = bind('promo')
const disease = bind('disease')
const medicalCenter = bind('medical-center')
const article = bind('article')
const siteServices = bind('site-services')

export const NewsListPage = news.ListPage
export const NewsEditPage = news.EditPage
export const NewsCreatePage = news.CreatePage

export const SitePromoListPage = promo.ListPage
export const SitePromoEditPage = promo.EditPage
export const SitePromoCreatePage = promo.CreatePage

export const DiseaseListPage = disease.ListPage
export const DiseaseEditPage = disease.EditPage
export const DiseaseCreatePage = disease.CreatePage

export const MedicalCenterListPage = medicalCenter.ListPage
export const MedicalCenterEditPage = medicalCenter.EditPage
export const MedicalCenterCreatePage = medicalCenter.CreatePage

export const ArticleListPage = article.ListPage
export const ArticleEditPage = article.EditPage
export const ArticleCreatePage = article.CreatePage

export const SiteServicesListPage = siteServices.ListPage
export const SiteServicesEditPage = siteServices.EditPage
export const SiteServicesCreatePage = siteServices.CreatePage
