import express from 'express';
import {
  getPublicSettings,
  updatePublicSettings,
  getAllPages,
  getPageBySlug,
  updatePageBySlug,
  submitContactInquiry,
  getContactInquiries,
  updateContactInquiryStatus,
  deleteContactInquiry
} from '../controllers/settingsController.js';
import verifyToken from '../middleware/authMiddleware.js';

const router = express.Router();

// 1. Homepage & Public Features Settings
router.get('/public', getPublicSettings);
router.put('/public', verifyToken, updatePublicSettings);

// 2. CMS Pages (Terms of Service, Usage, Privacy, About Us, Contact Us)
router.get('/pages', getAllPages);
router.get('/pages/:slug', getPageBySlug);
router.put('/pages/:slug', verifyToken, updatePageBySlug);

// 3. Contact Inquiries Management
router.post('/contact-inquiries', submitContactInquiry);
router.get('/contact-inquiries', verifyToken, getContactInquiries);
router.patch('/contact-inquiries/:id', verifyToken, updateContactInquiryStatus);
router.delete('/contact-inquiries/:id', verifyToken, deleteContactInquiry);

export default router;
