import express from "express";
import {
  AddPrivacyAndPolicy,
  AddShipping,
  AddTermsAndConditions,
  RefundPolicy,
  getPrivacyPolicy,
  getRefundPolicy,
  getShipping,
  getTermsAndCondition,
  updatePrivacyPolicy,
  updateShipping,
  updateTermsAndConditions,
  updateRefundPolicy,
  AddAboutUs,
  getAboutUs,
  updateAboutUs,
} from "./ContentController.js";
import { isAuthenticatedUser, authorizeRoles } from "../../middlewares/auth.js";

const router = express.Router();

router
  .route("/terms-and-conditions")
  .post(
    isAuthenticatedUser,
    authorizeRoles("admin", "Employee"),
    AddTermsAndConditions
  );
router.route("/terms-and-conditions").get(getTermsAndCondition);
router
  .route("/terms-and-condition-update")
  .patch(
    isAuthenticatedUser,
    authorizeRoles("admin", "Employee"),
    updateTermsAndConditions
  );
router
  .route("/privacy-and-policy")
  .post(
    isAuthenticatedUser,
    authorizeRoles("admin", "Employee"),
    AddPrivacyAndPolicy
  );
router.route("/privacy-and-policy").get(getPrivacyPolicy);
router
  .route("/privacy-and-policy-update")
  .patch(
    isAuthenticatedUser,
    authorizeRoles("admin", "Employee"),
    updatePrivacyPolicy
  );

router
  .route("/shipping-and-policy")
  .post(isAuthenticatedUser, authorizeRoles("admin", "Employee"), AddShipping);
router.route("/shipping-and-policy").get(getShipping);
router
  .route("/shipping-and-policy-update")
  .patch(
    isAuthenticatedUser,
    authorizeRoles("admin", "Employee"),
    updateShipping
  );
//refund Policy
router.route("/refund-policy").get(getRefundPolicy);
router
  .route("/refund-policy")
  .post(isAuthenticatedUser, authorizeRoles("admin", "Employee"), RefundPolicy);
router
  .route("/refund-policy-update")
  .patch(
    isAuthenticatedUser,
    authorizeRoles("admin", "Employee"),
    updateRefundPolicy
  );
//about us
router
  .route("/about-us")
  .post(isAuthenticatedUser, authorizeRoles("admin", "Employee"), AddAboutUs);
router.route("/about-us").get(getAboutUs);
router
  .route("/about-us-update")
  .patch(
    isAuthenticatedUser,
    authorizeRoles("admin", "Employee"),
    updateAboutUs
  );

export default router;
