# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name  : report.py
# @Time       : 2020/11/18 下午3:19
# @Author     : X. Peng
# @Email      : acepengxiong@163.com
# @Software   : PyCharm
# -----------------------------------------------------------------------------
import datetime
import time

from flask_restful import Resource, reqparse
from flask import request, render_template, g
from flask import make_response

from app.api.engine import config
from app.service.report_service import make_report
from app.utils.auth import login_require
from app.utils.html_to_pdf import html_to_pdf
from app.api.engine import pdf_folder, redis, env, TAMP_SQL, tamp_diagnose_app_engine
from app.utils.jinjia2html_v2 import DataIntegrate


class ReportHandlers(Resource):
    """."""

    def __init__(self):
        """."""
        self.parser = reqparse.RequestParser()

    @login_require
    def get(self):
        """."""
        self.parser.add_argument('customer_id', type=str, required=True, help='customer_id不能为空')
        args = self.parser.parse_args()
        args['ifa_id'] = g.ifa_id
        # 默认模版制作持仓报告
        data = make_report(args)

        resp = {
            "code": 0,
            "data": data,
            "lang": "zh_CN",
            "msg": "成功"
        }
        
        return resp

    def post(self):
        """."""
        pass

    def put(self, id):
        """."""
        pass

    def delete(self, id):
        """."""
        pass
