import CRMRequestPost from '../../../../../lib/CRMRequestPost';

export default async function handler(req, res) 
{
	console.log("\n\n", "API", "SIGN", "/document/create");

	const { entity_name, entity_id, sign_type, evo_id, code } = req.body;
	const payload = { 
		entityName: entity_name, 
		entityId: entity_id, 
		reportCodes: [ code ], 
		inputParameters: [ sign_type ], 
		createDocument: true, 
		openFile: false, 
		documentTypeEvoId: evo_id, 
	};

	console.log({ payload });

	await CRMRequestPost({ req, res, 
		path: `${ process.env.CRM_API_HOST }/File/GetWMDoc`, 
		params: payload, 
		headers: { "Content-Type": "application/json" }, 
		log: true, 
	});
}