import os

from django.conf import settings

from openpyxl.styles import Alignment, Border, Font, PatternFill, Side, Style

CELL_LOGO = 'P5'
DEFAULT_LOGO = os.path.join(settings.STATIC_ROOT, 'trainings/images/logo.png')

CELL_TITLE = 'B2'
CELL_SUBTITLE = 'B4'
CELL_INFO = 'P2'

COLUMN_MAX_WIDTH = 40

TOP_OFFSET = 4
RIGHT_OFFSET = 50
BOTTOM_OFFSET = 50
LEFT_OFFSET = 1

PRIMARY_COLOR = '8f0682'
SECONDARY_COLOR = '650075'
TERTIARY_COLOR = '9058a5'
QUATERNARY_COLOR = 'cba4cf'
BACKGROUND_COLOR = 'd8d9d1'

BORDER_COLOR = 'a6a6a6'

BLACK = '3f4036'
WHITE = 'FFFFFF'

MEDIUM = 'medium'
SOLID = 'solid'
HAIR = 'hair'

STYLES = {
    'HEADER_LINE': Style(
        fill=PatternFill(fill_type=SOLID, start_color=PRIMARY_COLOR),
    ),
    'HEADER_TITLE': Style(
        fill=PatternFill(fill_type=SOLID, start_color=BLACK),
        font=Font(size=24, color=WHITE),
        alignment=Alignment(vertical='center'),
    ),
    'DEFAULT': Style(
        fill=PatternFill(fill_type=SOLID, start_color=PRIMARY_COLOR),
        border=Border(
            left=Side(border_style=MEDIUM, color=BLACK),
            right=Side(border_style=MEDIUM, color=BLACK),
            top=Side(border_style=HAIR, color=BLACK),
            bottom=Side(border_style=HAIR, color=BLACK),
        ),
        font=Font(color=BLACK),
        alignment=Alignment(wrap_text=True)
    ),
    'EMPTY': Style(
        font=Font(size=16, color=BLACK),
        fill=PatternFill(fill_type=SOLID, start_color=BACKGROUND_COLOR),
    ),
    'HEADER_INFO': Style(
        font=Font(size=16, bold=True),
        fill=PatternFill(fill_type=SOLID, start_color=BACKGROUND_COLOR),
        alignment=Alignment(wrap_text=True, horizontal='right')
    ),
    'SUB_TITLE': Style(
        font=Font(size=20, color=PRIMARY_COLOR),
        fill=PatternFill(fill_type=SOLID, start_color=BACKGROUND_COLOR),
        alignment=Alignment(vertical='center'),
    ),
    'HEADER_TABLE': Style(
        font=Font(size=16, color=PRIMARY_COLOR),
        fill=PatternFill(fill_type=SOLID, start_color=BACKGROUND_COLOR),
        border=Border(
            bottom=Side(border_style='thin', color=BORDER_COLOR),
        ),
        alignment=Alignment(horizontal='left'),
    ),
    'DETAIL': Style(
        font=Font(size=22, color=BLACK),
        fill=PatternFill(fill_type=SOLID, start_color=BACKGROUND_COLOR),
        alignment=Alignment(horizontal='left'),
    )
}
