import { Router } from "express";
import { AuthController } from "../../controllers/Admin/AuthController";
import Authentication from "../../Middlewares/Authnetication";
const multer = require("multer");

class AuthRouter {
  public router: Router;

  constructor() {
    this.router = Router();
    this.post();
    this.get();
  }

  public post() {
     const storage = multer.memoryStorage();
     const upload = multer({ storage });
    this.router.post("/login", AuthController.login);
    this.router.post("/sign-up", AuthController.signUp);
    this.router.post(
      "/change-password",
      Authentication.admin,
      AuthController.changePassword
    );
    this.router.post(
      "/update-profile",
      Authentication.admin,
      AuthController.updateProfile
    );
    this.router.post(
      "/update-profile-image/:id",
      Authentication.admin,
      upload.single("image"),
      AuthController.updateProfileImage
    );
    this.router.post("/forgot-password", AuthController.forgotPassword);
    this.router.post("/reset-password", AuthController.resetPassword);
    this.router.post("/verify-otp", AuthController.verifyOtp);
    this.router.post(
      "/update-app-setting",
      Authentication.admin,
      AuthController.updateAppSetting
    );
    this.router.post(
      "/update-setting",
      Authentication.admin,
      AuthController.updateSetting
    );
  }
  public get() {
    this.router.get(
      "/get-profile",
      Authentication.admin,
      AuthController.getProfile
    );
     this.router.get(
       "/remove-profile-image/:id",
       Authentication.admin,
       AuthController.removeProfileImage
     );
    this.router.get(
      "/get-setting",
      Authentication.admin,
      AuthController.getSetting
    );
  }
}

export default new AuthRouter().router;
