import { Router } from "express";
import eqaro from "../controllers/eqaro.controller";
import authorize from "../middlewares/authorization.middleware";
import validateData from "../middlewares/validation.middleware";
import { addCoApplicantSchema } from "../schemas/eqaroCoApplicants.schema";
import { multerArrayFn, multerSingleFn } from "../middlewares/multer.middleware";

const router = Router();

router.post(
    "/tenant/login",
    authorize,
    eqaro.TenantLogin
);

router.post(
    "/tenant/coapplicant/add",
    authorize,
    validateData(addCoApplicantSchema),
    eqaro.AddCoApplicant    
);

router.post(
    "/tenant/pan/verify",
    authorize,
    eqaro.VerifyPan
);

router.post(
    "/tenant/work/generate/otp",
    authorize,
    eqaro.TenantEmailConfirmation
);

router.post(
    "/tenant/work/verify/otp",
    authorize,
    eqaro.TenantEmailOTPVerify
);

router.post(
    "/tenant/work/verify/doc",
    authorize,
    multerSingleFn,
    eqaro.TenantWorkVerifyViaDoc
);

router.post(
    "/tenant/aadhar/generate/otp",
    authorize,
    eqaro.AadharOKYC
);

router.post(
    "/tenant/aadhar/verify/otp",
    authorize,
    eqaro.VerifyAadharNumber
);

router.post(
    "/tenant/aadhar/upload",
    authorize,
    (req, res, next) => multerArrayFn(req, res, next, 2),
    eqaro.uploadAadhaar
);

router.post(
    "/tenant/bond/initiate",
    authorize,
    eqaro.InitiateBondPayment
);

router.post(
    "/tenant/bond/complete",
    authorize,
    eqaro.CompleteBondPayment
);

router.post(
    "/tenant/status",
    authorize,
    eqaro.GetTenantStatusByPhone
);

router.post(
    "/tenant/profile",
    authorize,
    eqaro.GetTenantProfileByPhone
);

router.get(
    "/tenant/bond/details",
    authorize,
    eqaro.GetBondDetails
);

router.get(
    "/tenant/download/bond",
    authorize,
    eqaro.GenerateBond
);

router.get(
    "/tenant/details",
    authorize,
    eqaro.GetTenantDetails
);

router.post(
    "/co-applicant/otp/generate",
    authorize,
    eqaro.SendOTPCoApplicantMobile
);

router.post(
    "/co-applicant/otp/verify",
    authorize,
    eqaro.VerifyCoApplicantMobile
);

export default router;