import express from 'express';
const router = express.Router();

import * as itemController from '../controllers/itemController.js';
import * as s3bucketController from '../controllers/s3bucketController.js';

// GET request for Item details, with it's history record
router.get('/:id', itemController.item_view_get, itemController.item_history_get);

// GET request for Item Edit View
router.get('/:id/edit', itemController.item_editview_get);

// PUT request to Update Item
router.put('/:id/edit/submit', itemController.item_submit_put);

// GET request for Format based on Item Type for creation
router.get('/create/:itemtype/:subtype', itemController.item_type_format_get);

// POST request to submit New Item, and make history record
router.post('/create/submit', itemController.item_new_post);

// GET request for Item History
router.get('/:id/history', itemController.item_history_get);

// POST request for uploading new/edited item to s3 bucket
router.post('/upload', s3bucketController.upload_doc);

// GET request for downloading item document from s3 bucket
router.post('/:id/download/:versionId', s3bucketController.download_doc);

// POST request to create PDF - testing
router.post('/pdf', itemController.create_pdf);

module.exports = router;