import { css } from 'styled-components/macro'

import { isMobileDevice } from 'config/userAgent'

import { PROCEDURES } from '../procedures'

import {
  ClientConfig,
  ClientIds,
  ClientNames,
} from './types'

const randomHash = () => (
  (Math.random() ** Math.random()) * 100000000000000
)

const params = {
  _p_version: 'facrtv',
}

export const facr: ClientConfig = {
  auth: {
    clientId: ClientIds.Facr,
    metaDataUrlParams: `?hash=${randomHash()}`,
  },
  currencyBadge: {
    color: '#333333',
    secondColor: 'rgba(255, 255, 255, 0.7)',
    sign: 'Dollar',
  },
  defaultLanguage: 'cs',
  description: 'Live sports streaming platform. All matches playing under the auspices of Czech Republic FA. Access to full matches, various player playlists, and highlights. Free access in the Czech Republic. Available across all devices',
  disabledPreferences: false,
  host: 'facr.tv',
  name: ClientNames.Facr,
  privacyLink: '/privacy-policy-and-statement',
  requests: {
    [PROCEDURES.get_matches]: params,
    [PROCEDURES.get_team_matches]: params,
    [PROCEDURES.get_player_matches]: params,
    [PROCEDURES.get_tournament_matches]: params,
  },
  showSearch: false,
  styles: {
    background: '',
    homePageHeader: css`
      background: ${(isMobileDevice
    ? 'linear-gradient(180deg, #00257A 0%, rgba(0, 37, 122, 0) 100%), #000000'
    : 'linear-gradient(83.42deg, #00257A 53.04%, rgba(0, 0, 0, 0) 94.83%), #000000'
  )};`,
    logo: 'facr-logo.svg',
    logoHeight: 6.3,
    logoLeft: 1.1,
    logoTop: 1.74,
    logoWidth: 8.25,
    matchLogoHeight: 3.4,
    matchLogoTopMargin: 0.9,
    matchLogoWidth: 4.5,
    matchPageMobileHeaderLogo: css`
      width: 35px;
      height: 25px;
      top: 2px;
    `,
    mobileHeaderLogo: css`
      width: 48px;
      height: 37px;
    `,
    userAccountLogo: css`
      width: 4.56rem;
      height: 3.488rem;
    `,
  },
  termsLink: '/terms-and-conditions?client_id=facr-ott-web',
  title: 'FACR.TV - The home of Czech football streaming',
  userAccountLinksDisabled: true,
}
