const company = require('../../models/company');
const social = require('../../models/social');
const helper = require('../../helper');
const express = require("express");
const bodyParser = require("body-parser");
const router = express.Router();
const config = require("../../config")
//var jsonParser = bodyParser.json()
//var urlencodedParser = bodyParser.urlencoded({ extended: false })
const app = express();
app.use(express.json());

router.post("/header", async (req, res, next) => {
     if(helper.check_headers(req) == "True"){
        var logo = await  company.get_company_logos()
        var social_link = await social.get_social_links();
        var company_logo ={
            company_logo:config.baxter_url+"images/logo/"+logo.company_logo,
            company_white_logo:config.baxter_url+"images/logo/"+logo.company_white_logo
        }

        res.status(200).json({
            message: "Successfull",
            status: "True",
            data:{
                company_logo: company_logo,
                social_link: social_link
            }
        });
     }else{
        res.status(200).json({
            message: "Unauthorised request",
            status: "Fail"
        });
     }
});

module.exports = router;