import { createRouter, defineEventHandler, useBase } from 'h3'
import * as navigationCtrl from '~/server/models/navigation'
import * as eventCtrl from '~/server/models/event'
import * as tagCtrl from '~/server/models/tag'
import * as topicCtrl from '~/server/models/topic'
import * as pollCtrl from '~/server/models/poll'
import * as pollOptionCtrl from '~/server/models/poll-option'
import * as pollResponseCtrl from '~/server/models/poll-response'
import * as CategoryCtrl from '~/server/models/category'
import * as quizCtrl from '~/server/models/quiz'
import * as survetCtrl from '~/server/models/survey'

const router = createRouter()

router.get('/navigation', defineEventHandler(navigationCtrl.get)) 
router.get('/tag', defineEventHandler(tagCtrl.fetchById))
router.get('/topic', defineEventHandler(topicCtrl.fetchById))
router.get('/event', defineEventHandler(eventCtrl.fetchById))
router.get('/poll-by-id', defineEventHandler(pollCtrl.fetchById))
router.get('/poll-option/pollId', defineEventHandler(pollOptionCtrl.fetchByPollId))
router.post('/poll-response', defineEventHandler(pollResponseCtrl.create))
router.get('/poll-response/pollId', defineEventHandler(pollResponseCtrl.fetchByPollId))
router.get('/quiz/get-by-id', defineEventHandler(quizCtrl.fetchById))
router.get('/survey/get-by-id', defineEventHandler(survetCtrl.fetchById))
router.get('/category-tree', defineEventHandler(CategoryCtrl.list))
export default useBase('/api/services', router.handler)
