import * as R from "ramda";

import { transformColorCode as fixColorHexCode } from "@applicaster/zapp-react-native-utils/transform";

const localAssets = R.either(
  R.path(["sdkAssets", "bgImage"]),
  R.path(["sdkAssets", "app_background_image_1080p"])
);

const remoteAssets = R.either(
  R.path(["assets", "universal", "bgImage"]),
  R.path(["assets", "universal", "app_background_image_1080p"])
);

export const getBackgroundImageUrl = (remoteConfigurations) =>
  R.either(localAssets, remoteAssets)(remoteConfigurations);

export const getBackgroundColor = (styles) =>
  fixColorHexCode(styles?.tv?.background_color?.color);
