import dayjs from 'dayjs';
import weekOfYearPlugin from 'dayjs/plugin/weekOfYear';

dayjs.extend(weekOfYearPlugin);

export const CALENDAR_FILTER_VALUE = {
  thisMonth: {
    label: 'This month',
    dateRange: {
      stringFrom: 'now/M',
    },
    dateRangeComparison: {
      stringFrom: 'now-1M/M',
      stringTo: 'now-1M',
    },
    ranges: [
      {
        stringFrom: 'now/M',
      },
      {
        stringFrom: 'now-1M/M',
        stringTo: 'now/M',
      },
    ],
    interval: {
      unit: 'DAYS',
      value: 1,
    },
    xTickFormatter: (value) => value.format('DD'),
    chipFormatter: (value) => value.format('MMMM YYYY'),
    chartTooltipFormatter: (value) => value.format('ddd MMM DD'),
  },
  previousMonth: {
    label: 'Previous month',
    dateRange: {
      stringFrom: 'now-1M/M',
      stringTo: 'now/M',
    },
    dateRangeComparison: {
      stringFrom: 'now-2M/M',
      stringTo: 'now-1M/M',
    },
    ranges: [
      {
        stringFrom: 'now-1M/M',
        stringTo: 'now/M',
      },
      {
        stringFrom: 'now-2M/M',
        stringTo: 'now-1M/M',
      },
    ],
    interval: {
      unit: 'DAYS',
      value: 1,
    },
    xTickFormatter: (value) => value.format('DD'),
    chipFormatter: (value) => value.format('MMMM YYYY'),
    chartTooltipFormatter: (value) => value.format('ddd MMM DD'),
  },
  thisWeek: {
    label: 'This week',
    dateRange: {
      stringFrom: 'now/w',
    },
    dateRangeComparison: {
      stringFrom: 'now-1w/w',
      stringTo: 'now-1w',
    },
    ranges: [
      {
        stringFrom: 'now/w',
      },
      {
        stringFrom: 'now-1w/w',
        stringTo: 'now/w',
      },
    ],
    interval: {
      unit: 'DAYS',
      value: 1,
    },
    xTickFormatter: (value) => value.format('ddd'),
    chipFormatter: (value) => `Week ${dayjs(value).week()}`,
    chartTooltipFormatter: (value) => `${value.format('ddd MMM DD')}, Week ${dayjs(value).week()}`,
  },
  today: {
    label: 'Today',
    dateRange: {
      stringFrom: 'now/d',
    },
    ranges: [
      {
        stringFrom: 'now/d',
      },
      {
        stringFrom: 'now-1d/d',
        stringTo: 'now/d',
      },
      {
        stringFrom: 'now-7d/d',
        stringTo: 'now-6d/d',
      },
    ],
    interval: {
      unit: 'HOURS',
      value: 1,
    },
    xTickFormatter: (value) => value.format('HH'),
    chipFormatter: (value) => value.format('MMM DD'),
    chartTooltipFormatter: (value) => value.format('ddd MMM DD'),
    chartTooltipTitleFormatter: (value) => `${value.format('HH')}:00`,
  },
  yesterday: {
    label: 'Yesterday',
    dateRange: {
      stringFrom: 'now-1d/d',
      stringTo: 'now/d',
    },
    ranges: [
      {
        stringFrom: 'now-1d/d',
        stringTo: 'now/d',
      },
      {
        stringFrom: 'now-2d/d',
        stringTo: 'now-1d/d',
      },
      {
        stringFrom: 'now-8d/d',
        stringTo: 'now-7d/d',
      },
    ],
    interval: {
      unit: 'HOURS',
      value: 1,
    },
    xTickFormatter: (value) => value.format('HH'),
    chipFormatter: (value) => value.format('MMM DD'),
    chartTooltipFormatter: (value) => value.format('ddd MMM DD'),
    chartTooltipTitleFormatter: (value) => `${value.format('HH')}:00`,
  },
  last7days: {
    label: 'Last 7 days',
    dateRange: {
      stringFrom: 'now-6d/d',
    },
    dateRangeComparison: {
      stringFrom: 'now-13d/d',
      stringTo: 'now-6d/d',
    },
    ranges: [
      {
        stringFrom: 'now-13d/d',
        stringTo: 'now-6d/d',
      },
      {
        stringFrom: 'now-6d/d',
      },
    ],
    interval: {
      unit: 'DAYS',
      value: 1,
    },
    xTickFormatter: (value) => value.format('ddd'),
    chipFormatter: (valueFirst, valueLast) =>
      valueLast ? `${valueFirst.format('MMM DD')} - ${valueLast.format('MMM DD')}` : valueFirst.format('MMM DD'),
    chartTooltipFormatter: (value) => value.format('ddd MMM DD'),
  },
  last30days: {
    label: 'Last 30 days',
    dateRange: {
      stringFrom: 'now-29d/d',
    },
    dateRangeComparison: {
      stringFrom: 'now-59d/d',
      stringTo: 'now-29d/d',
    },
    ranges: [
      {
        stringFrom: 'now-29d/d',
      },
    ],
    interval: {
      unit: 'DAYS',
      value: 1,
    },
    xTickFormatter: (value) => value.format('DD'),
    chipFormatter: (valueFirst, valueLast) =>
      valueLast ? `${valueFirst.format('MMM DD')} - ${valueLast.format('MMM DD')}` : valueFirst.format('MMM DD'),
    chartTooltipFormatter: (value) => value.format('ddd MMM DD'),
  },
  custom: 'Custom',
};

export const CALENDAR_FILTER_CUSTOM = -1;
export const CALENDAR_FILTER_THIS_MONTH = 1;
export const CALENDAR_FILTER_PREVIOUS_MONTH = 2;
export const CALENDAR_FILTER_LAST_30_DAYS = 3;
export const CALENDAR_FILTER_THIS_WEEK = 4;
export const CALENDAR_FILTER_LAST_7_DAYS = 5;
export const CALENDAR_FILTER_TODAY = 6;
export const CALENDAR_FILTER_YESTERDAY = 7;

export const CALENDAR_FILTER_ADAPTER = {
  [CALENDAR_FILTER_THIS_MONTH]: {
    range: {
      stringFrom: 'now/M',
      stringTo: undefined,
    },
    interval: {
      unit: 'DAYS',
      value: 1,
    },
  },
  [CALENDAR_FILTER_PREVIOUS_MONTH]: {
    range: {
      stringFrom: 'now-1M/M',
      stringTo: 'now/M',
    },
    interval: {
      unit: 'DAYS',
      value: 1,
    },
  },
  [CALENDAR_FILTER_THIS_WEEK]: {
    range: {
      stringFrom: 'now/w',
      stringTo: undefined,
    },
    interval: {
      unit: 'DAYS',
      value: 1,
    },
  },
  [CALENDAR_FILTER_TODAY]: {
    range: {
      stringFrom: 'now/d',
      stringTo: undefined,
    },
    interval: {
      unit: 'HOURS',
      value: 1,
    },
  },
  [CALENDAR_FILTER_YESTERDAY]: {
    range: {
      stringFrom: 'now-1d/d',
      stringTo: 'now/d',
    },
    interval: {
      unit: 'HOURS',
      value: 1,
    },
  },
  [CALENDAR_FILTER_LAST_7_DAYS]: {
    range: {
      stringFrom: 'now-6d/d',
      stringTo: undefined,
    },
    interval: {
      unit: 'DAYS',
      value: 1,
    },
  },
  [CALENDAR_FILTER_LAST_30_DAYS]: {
    range: {
      stringFrom: 'now-29d/d',
      stringTo: undefined,
    },
    interval: {
      unit: 'DAYS',
      value: 1,
    },
  },
  [CALENDAR_FILTER_CUSTOM]: {
    range: {
      stringFrom: '',
      stringTo: undefined,
    },
    interval: {
      unit: '',
      value: 0,
    },
  },
};

export const CALENDAR_FILTER_LIST = [
  CALENDAR_FILTER_THIS_MONTH,
  CALENDAR_FILTER_PREVIOUS_MONTH,
  CALENDAR_FILTER_LAST_30_DAYS,
  CALENDAR_FILTER_THIS_WEEK,
  CALENDAR_FILTER_LAST_7_DAYS,
  CALENDAR_FILTER_TODAY,
  CALENDAR_FILTER_YESTERDAY,
  CALENDAR_FILTER_CUSTOM,
];

// todo: add filter props mapping
export const CALENDAR_FILTER_COLLECTION = [
  {
    label: 'This month',
    value: CALENDAR_FILTER_THIS_MONTH,
  },
  {
    label: 'Previous month',
    value: CALENDAR_FILTER_PREVIOUS_MONTH,
  },
  {
    label: 'Last 30 days',
    value: CALENDAR_FILTER_LAST_30_DAYS,
  },
  {
    label: 'This week',
    value: CALENDAR_FILTER_THIS_WEEK,
  },
  {
    label: 'Last 7 days',
    value: CALENDAR_FILTER_LAST_7_DAYS,
  },
  {
    label: 'Today',
    value: CALENDAR_FILTER_TODAY,
  },
  {
    label: 'Yesterday',
    value: CALENDAR_FILTER_YESTERDAY,
  },
  {
    label: 'Custom',
    value: CALENDAR_FILTER_CUSTOM,
  },
];

export const CALENDAR_FILTER = [
  { label: CALENDAR_FILTER_VALUE.thisMonth.label, value: CALENDAR_FILTER_VALUE.thisMonth },
  { label: CALENDAR_FILTER_VALUE.previousMonth.label, value: CALENDAR_FILTER_VALUE.previousMonth },
  { label: CALENDAR_FILTER_VALUE.last30days.label, value: CALENDAR_FILTER_VALUE.last30days },
  { label: CALENDAR_FILTER_VALUE.thisWeek.label, value: CALENDAR_FILTER_VALUE.thisWeek },
  { label: CALENDAR_FILTER_VALUE.last7days.label, value: CALENDAR_FILTER_VALUE.last7days },
  { label: CALENDAR_FILTER_VALUE.today.label, value: CALENDAR_FILTER_VALUE.today },
  { label: CALENDAR_FILTER_VALUE.yesterday.label, value: CALENDAR_FILTER_VALUE.yesterday },
  { label: 'Custom', value: CALENDAR_FILTER_VALUE.custom },
];

export const DEVICE_DESKTOP = 'DESKTOP';
export const DEVICE_MOBILE = 'MOBILE';
export const DEVICE_OTHER = 'OTHER';

export const DEVICE_LIST = [DEVICE_DESKTOP, DEVICE_MOBILE, DEVICE_OTHER];
export const DEVICE_COLLECTION = [
  { label: 'Desktop', value: DEVICE_DESKTOP },
  { label: 'Mobile', value: DEVICE_MOBILE },
  { label: 'Other', value: DEVICE_OTHER },
];

export const DEVICES = [
  {
    label: 'Desktop',
    value: 'DESKTOP',
  },
  {
    label: 'Mobile',
    value: 'MOBILE',
  },
  {
    label: 'Other',
    value: 'OTHER',
  },
];

export const AD_FORMAT_CONFIG_VIDEO = 'VIDEO';
export const AD_FORMAT_CONFIG_DISPLAY = 'DISPLAY';
export const AD_FORMAT_CONFIG_SPONSORED = 'SPONSORED';
export const AD_FORMAT_CONFIG_ALL = '';

export const AD_FORMAT_LIST = [
  AD_FORMAT_CONFIG_VIDEO,
  AD_FORMAT_CONFIG_DISPLAY,
  AD_FORMAT_CONFIG_SPONSORED,
  AD_FORMAT_CONFIG_ALL,
];

export const AD_FORMAT_COLLECTION = [
  { label: 'Video', value: AD_FORMAT_CONFIG_VIDEO },
  { label: 'Display', value: AD_FORMAT_CONFIG_DISPLAY },
  { label: 'Sponsored', value: AD_FORMAT_CONFIG_SPONSORED },
  { label: 'All Formats', value: AD_FORMAT_CONFIG_ALL },
];

export const AD_FORMAT_CONFIG = {
  video: {
    label: 'Video',
    value: 'VIDEO',
  },
  display: {
    label: 'Display',
    value: 'DISPLAY',
  },
  sponsored: {
    label: 'Sponsored',
    value: 'SPONSORED',
  },
  all: {
    label: 'All Formats',
    value: null,
  },
};

export const AD_FORMATS = [
  AD_FORMAT_CONFIG.video,
  AD_FORMAT_CONFIG.display,
  AD_FORMAT_CONFIG.sponsored,
  AD_FORMAT_CONFIG.all,
];

export const CARDS_FILTERS_ALL = [
  {
    id: 'Revenue',
    key: 'externalRevenues',
    prefix: '$',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Revenue',
          tooltip: 'Revenue generated by video ads within selected period, demand source, domain, devices, and country',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Revenue',
          tooltip:
            'Revenue generated by display ads within selected period, demand source, domain, devices, and country',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: 'Revenue',
          tooltip:
            'Revenue generated by sponsored ads within selected period, demand source, domain, devices, and country',
        };
      }

      return {
        title: 'Revenue',
        tooltip: 'Revenue generated by all ads within selected period, demand source, domain, devices, and country',
      };
    },
  },
  {
    id: 'PlatformFees',
    key: 'platformFee',
    prefix: '$',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Platform Fees',
          tooltip: 'Total platform fees charged to you for delivering video ads from your demand sources',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Platform Fees',
          tooltip: 'Total platform fees charged to you for delivering display ads from your demand sources',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: 'Platform Fees',
          tooltip: 'Total platform fees charged to you for delivering sponsored ads from your demand sources',
        };
      }

      return {
        title: 'Platform Fees',
        tooltip: 'Total platform fees charged to you for delivering ads from your demand sources across all formats',
      };
    },
  },
  {
    id: 'netRevenue',
    key: 'netRevenue',
    prefix: '$',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'NET Revenue',
          tooltip: 'Video ad revenue after platform fees and revenue share deductions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'NET Revenue',
          tooltip: 'Display ad revenue after platform fees and revenue share deductions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: 'NET Revenue',
          tooltip: 'Sponsored ad revenue after platform fees and revenue share deductions',
        };
      }
      return {
        title: 'NET Revenue',
        tooltip: 'Total revenue across all formats after platform fees and revenue share deductions',
      };
    },
  },
  {
    id: 'RPM',
    key: 'rpm',
    prefix: '$',
    getCardConfig: ({ adFormat, demandSources }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Ad RPM',
          tooltip: 'Revenue generated by Video ads for every 1000 Video ad impressions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Ad RPM',
          tooltip: 'Revenue generated by Display ads for every 1000 Display ad impressions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: 'Ad RPM',
          tooltip: 'Revenue generated by sponsored ads for every 1000 sponsored ad impressions',
          key: demandSources.length ? 'cpm' : 'rpm',
        };
      }

      return {
        title: 'Page RPM',
        tooltip: 'Revenue generated by display and video ads for every 1000 player loads',
      };
    },
  },
  {
    id: 'Viewability',
    key: 'viewability',
    postfix: '%',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Ad Viewability',
          tooltip: 'Ratio of Viewable Video ad impressions to all Video ad impressions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Ad Viewability',
          tooltip: 'Ratio of viewable Display ad impressions to all Display ad Impressions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: 'Ad Viewability',
          tooltip: 'Ratio of Viewable sponsored ad impressions to all sponsored ad impressions',
        };
      }

      return {
        title: 'Player Viewability',
        tooltip: 'Ratio of viewable player loads to all player loads',
      };
    },
  },
  {
    id: 'AdImpressions',
    key: 'lreImpressions',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          key: 'adImpressions',
          title: 'Ad Impressions',
          tooltip: 'Number of Video ads served',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          key: 'adImpressions',
          title: 'Ad Impressions',
          tooltip: 'Number of Display ads served',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          key: 'adImpressions',
          title: 'Ad Impressions',
          tooltip: 'Number of sponsored ads served',
        };
      }

      return {
        title: 'Player Ad Impressions',
        tooltip: 'Number of player loads that served at least 1 ad impression',
      };
    },
  },
  {
    id: 'FillRate',
    key: 'fillRate',
    postfix: '%',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Fill Rate',
          tooltip: 'Ratio of Video ad impressions to video ad requests',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Fill Rate',
          tooltip: 'Ratio of Display ad impressions to Display ad requests',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: '',
          tooltip: '',
          hide: true,
        };
      }

      return {
        title: 'Fill Rate',
        tooltip: 'Ratio of player ad impressions to player loads',
      };
    },
  },
  {
    id: 'PlayerLoads',
    key: 'lreOpportunities',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Player Loads',
          tooltip: 'Number of times video player has been loaded in an ad blocker free page',
          hide: true,
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Player Loads',
          tooltip: 'Not available for Display ad format',
          hide: true,
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: '',
          tooltip: '',
          hide: true,
        };
      }

      return {
        title: 'Player Loads',
        tooltip: 'Number of times video player has been loaded in an ad blocker free page',
      };
    },
    disableByAdFormat: (adFormat) => [AD_FORMAT_CONFIG.display.value].includes(adFormat),
  },
  {
    id: 'AdClicks',
    key: 'adClicks',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: 'Ad Clicks',
          tooltip: 'Number of sponsored ads clicks',
        };
      }

      return {
        title: '',
        tooltip: '',
        hide: true,
      };
    },
  },
  {
    id: 'Ctr',
    key: 'ctr',
    postfix: '%',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.sponsored.value) {
        return {
          title: 'CTR',
          tooltip: 'Ratio of sponsored ad clicks to all sponsored ad impressions',
        };
      }

      return {
        title: '',
        tooltip: '',
        hide: true,
      };
    },
  },
];

export const CARDS_FILTERS_FOR_SOURCES = [
  {
    id: 'Revenue',
    key: 'externalRevenues',
    prefix: '$',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Revenue',
          tooltip: 'Revenue generated by video ads within selected period, demand source, domain, devices, and country',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Revenue',
          tooltip:
            'Revenue generated by display ads within selected period, demand source, domain, devices, and country',
        };
      }

      return {
        title: 'Revenue',
        tooltip: 'Revenue generated by all ads within selected period, demand source, domain, devices, and country',
      };
    },
  },
  {
    id: 'PlatformFees',
    key: 'platformFee',
    prefix: '$',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Platform Fees',
          tooltip: 'Total platform fees charged to you for delivering video ads from your demand sources',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Platform Fees',
          tooltip: 'Total platform fees charged to you for delivering display ads from your demand sources',
        };
      }

      return {
        title: 'Platform Fees',
        tooltip: 'Total platform fees charged to you for delivering ads from your demand sources across all formats',
      };
    },
  },
  {
    id: 'netRevenue',
    key: 'netRevenue',
    prefix: '$',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'NET Revenue',
          tooltip: 'Video ad revenue after platform fees and revenue share deductions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'NET Revenue',
          tooltip: 'Display ad revenue after platform fees and revenue share deductions',
        };
      }

      return {
        title: 'NET Revenue',
        tooltip: 'Total revenue across all formats after platform fees and revenue share deductions',
      };
    },
  },
  {
    id: 'CPM',
    key: 'cpm',
    prefix: '$',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Ad RPM',
          tooltip: 'Revenue generated for every 1000 video ad impressions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Ad RPM',
          tooltip: 'Revenue generated for every 1000 display ad impressions',
        };
      }

      return {
        title: 'Ad RPM',
        tooltip: 'Only available for Video or Display ad formats separately.',
      };
    },
    disableByAdFormat: (adFormat) => [AD_FORMAT_CONFIG.all.value].includes(adFormat),
  },
  {
    id: 'Viewability',
    key: 'viewability',
    postfix: '%',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Ad Viewability',
          tooltip: 'Ratio of viewable video ad impressions to all video ad impressions',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Ad Viewability',
          tooltip: 'Ratio of viewable display ad impressions to all display ad impressions',
        };
      }

      return {
        title: 'Ad Viewability',
        tooltip: 'Only available for Video or Display ad formats separately.',
      };
    },
    disableByAdFormat: (adFormat) => [AD_FORMAT_CONFIG.all.value].includes(adFormat),
  },
  {
    id: 'AdImpressions',
    key: 'adImpressions',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Ad Impressions',
          tooltip: 'Number of video ads played',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Ad Impressions',
          tooltip: 'Number of display ads shown',
        };
      }

      return {
        title: 'Ad Impressions',
        tooltip: 'Number of all ads shown',
      };
    },
  },
  {
    id: 'FillRate',
    key: 'fillRate',
    postfix: '%',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Fill Rate',
          tooltip: 'Ratio of video ad impressions to video ad requests',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Fill Rate',
          tooltip: 'Ratio of display ad impressions to display ad requests',
        };
      }

      return {
        title: 'Fill Rate',
        tooltip: 'Only available for Video or Display ad formats separately.',
      };
    },
    disableByAdFormat: (adFormat) => [AD_FORMAT_CONFIG.all.value].includes(adFormat),
  },
  {
    id: 'AdRequests',
    key: 'adRequests',
    getCardConfig: ({ adFormat }) => {
      if (adFormat === AD_FORMAT_CONFIG.video.value) {
        return {
          title: 'Ad Requests',
          tooltip: 'How many times have the players called for a video ad to be served',
        };
      }

      if (adFormat === AD_FORMAT_CONFIG.display.value) {
        return {
          title: 'Ad Requests',
          tooltip: 'How many times have the players called for a display ad to be served',
        };
      }

      return {
        title: 'Ad Requests',
        tooltip: 'Only available for Video or Display ad formats separately.',
      };
    },
    disableByAdFormat: (adFormat) => [AD_FORMAT_CONFIG.all.value].includes(adFormat),
  },
];
