# © 2021 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models

PAPER_SIZES = [
    {
        'description': 'E1  57 x 35 mm',
        'key': 'E1',
        'height': 35.0,
        'width': 57.0,
    }, {
        'key': 'E2',
        'description': 'E2   40 x 45 mm',
        'height': 45.0,
        'width': 40.0,
    },
]


class ReportTicketformat(models.Model):
    _name = "report.ticketformat"
    _description = "Format pour impression tickets"

    name = fields.Char('Nom', required=True)
    default = fields.Boolean('Default paper format ?')
    format = fields.Selection(
        [(ps['key'], ps['description']) for ps in PAPER_SIZES],
        "Taille de l'étiquette",
        default='E1', help="Sélectionner le format de l'étiquette")
    # margin_top = fields.Float('Top Margin (mm)', default=40)
    # margin_bottom = fields.Float('Bottom Margin (mm)', default=20)
    # margin_left = fields.Float('Left Margin (mm)', default=7)
    # margin_right = fields.Float('Right Margin (mm)', default=7)
    page_height = fields.Integer('Hauteur du ticket (mm)', default=False)
    page_width = fields.Integer('Largeur du ticket (mm)', default=False)
    header_line = fields.Boolean('Display a header line', default=False)
    # header_spacing = fields.Integer('Header spacing', default=35)
    # dpi = fields.Integer('Output DPI', required=True, default=90)
    # report_ids = fields.One2many('ir.actions.report', 'paperformat_id', 'Associated reports', help="Explicitly associated reports")
    # print_page_width = fields.Float('Print page width (mm)', compute='_compute_print_page_size')
    # print_page_height = fields.Float('Print page height (mm)', compute='_compute_print_page_size')