const express = require('express')
const { getUserOffers, getOfferTypes, handleSuccessfulOfferPayment, handleFailedOfferPayment, updateOfferStatus, createOfferComment } = require('../../../controllers/application/offer/offerController')
const { initiateOfferPaymentWeb, handleOfferPaymentCallback } = require('../../../controllers/application/payment/paymentControllerWeb')
const blockCheck = require('../../../middlewares/blockCheck')
const isRegister = require('../../../middlewares/isRegister')
const auth = require('./../../../middlewares/auth')

const router = express.Router()
router.get('/', getUserOffers)
router.get('/types', [auth], getOfferTypes)
router.post('/update-status', [auth], updateOfferStatus)
router.post('/payment-success', [auth], handleSuccessfulOfferPayment)
router.post('/payment-failed', [auth], handleFailedOfferPayment)
router.post('/comment', [auth], createOfferComment)
router.post('/initiate-payment-web', [auth], [blockCheck], initiateOfferPaymentWeb)
router.get('/payment-web', handleOfferPaymentCallback)

module.exports = router
