import express from 'express';
import { authenticate } from '../middleware/authMiddleware.js';
import SocialNetworkController from '../controllers/socialnetworkController.js';
import multer from 'multer';
const upload = multer();

const router = express.Router();
const socialNetworkController = new SocialNetworkController();

router.use(authenticate);

router.post('/usersearch', socialNetworkController.userSearch);
router.get('/profile/main/:userId', socialNetworkController.profile);
router.post('/folders/:folderId', socialNetworkController.createFolder);
router.get('/folders', socialNetworkController.getFolders);
router.get('/folder/:folderId', socialNetworkController.getFolderImageList);
router.post('/images', upload.single('image'), socialNetworkController.uploadImage);
router.get('/images/:imageId', socialNetworkController.getImage);
router.put('/images/:imageId', socialNetworkController.changeImage);
router.get('/imagevisibilities', socialNetworkController.getImageVisibilityTypes);
router.get('/image/:hash', socialNetworkController.getImageByHash);
router.get('/profile/images/folders/:username', socialNetworkController.getFoldersByUsername);
router.delete('/folders/:folderId', socialNetworkController.deleteFolder);
router.post('/guestbook/entries', upload.single('image'), socialNetworkController.createGuestbookEntry);
router.get('/guestbook/entries/:username/:page', socialNetworkController.getGuestbookEntries);
router.delete('/guestbook/entries/:entryId', socialNetworkController.deleteGuestbookEntry);
router.get('/guestbook/image/:guestbookUserName/:entryId', socialNetworkController.getGuestbookImage);
router.post('/diary', socialNetworkController.createDiaryEntry);
router.put('/diary/:diaryEntryId', socialNetworkController.updateDiaryEntry);
router.delete('/diary/:entryId', socialNetworkController.deleteDiaryEntry);
router.get('/diary/:page', socialNetworkController.getDiaryEntries);
router.post('/friend', socialNetworkController.addFriend);
router.delete('/friend/:friendUserId', socialNetworkController.removeFriend);
router.put('/friend/:friendUserId', socialNetworkController.acceptFriendship);
router.get('/friends/loggedin', socialNetworkController.getLoggedInFriends);

export default router;
