const DocumentRepository = require('../models/documentRepository');

const getAllDesignOrderAttachments = async (req, reply) => {
  try {
    const requestProposals = await DocumentRepository.getAllRequestProposalAttachmentsModal();
    const designOrders = await DocumentRepository.getAllDesignOrderAttachmentsModal();
    const requestAttachments = await DocumentRepository.getAllRequestAttachmentsModal();
    const projectFiles = await DocumentRepository.getAllProjectFilesModal();
    const projectTaskFiles = await DocumentRepository.getAllProjectTaskFilesModal();
    const staffTaskFiles = await DocumentRepository.getAllStaffTaskFilesModal();

    reply.send({
      status: true,
      message: 'Fetched successfully',
      request_proposals: requestProposals,
      design_orders: designOrders,
      request_attachments: requestAttachments,
      project_files: projectFiles,
      project_task_files: projectTaskFiles,
      staff_task_files: staffTaskFiles,
    });
  } catch (error) {
    console.error('Error in getAllDocumentAttachments:', error);
    reply.code(500).send({ status: false, message: 'Internal server error' });
  }
};

module.exports = {
  getAllDesignOrderAttachments
};