import { capitalizeEachWord } from '../../helpers';

export enum DATA_TYPE {
  REQUESTED = 'requested',
  ORIGINAL = 'original',
}
export enum STATUS_DATA {
  DRAFT = 'draft',
  ACTIVE = 'active',
  INACTIVE = 'inactive',
  REQUESTED = 'requested',
  OPEN = 'open',
  DECLINE = 'declined',
  DELETED = 'deleted',
  WAITING = 'waiting',
  CANCEL = 'cancel',
  DONE = 'done',
  IN_PROCESS = 'in_process',
  CLOSED = 'closed',
  TODO = 'todo',
  ON_HOLD = 'on_hold',
  BLOCKED = 'blocked',
  BLACKLIST = 'blacklist',
  PROBLEM = 'problem',
  POSTED = 'posted',
  PAID = 'paid',
  APPROVED = 'approved',
  PENDING = 'pending',
  REJECTED = 'rejected',
  SETTLED = 'settled',
  CONFIRMED = 'confirmed',
  PROCESS_REFUND = 'proses refund',
  PROCESS_REFUND_WAHANA = 'proses refund wahana',
  REFUNDED = 'refunded',
  PARTIAL_REFUND = 'partial refund',
}

export enum STATUS_DATA_COLOR {
  // DRAFT = '#4A6785',
  // ACTIVE = '#00875a',
  // INACTIVE = '#cf1322',
  // REQUESTED = '#faad14',
  // OPEN = '#0052cc',
  // DECLINE = '#cf1322',
  // DELETED = '#cf1322',
  // WAITING = '#faad14',
  // CANCEL = '#cf1322',
  // DONE = '#00875a',
  // IN_PROCESS = '#0052cc',
  // CLOSED = '#cf1322',
  // TODO = '#4A6785',
  // ON_HOLD = '#4A6785',
  // BLOCKED = '#cf1322',
  // BLACKLIST = '#cf1322',

  DRAFT = '#95A5A6',
  ACTIVE = '#3EBD93',
  INACTIVE = '#E74C3C',
  REQUESTED = '#F39C12',
  OPEN = '#6F7CBA',
  DECLINE = '#B71C1C',
  DELETED = '#FF5252',
  WAITING = '#6c5dd0',
  CANCEL = '#9B59B6',
  // CANCEL = '#FF5252',
  // DONE = '#27AE60',
  DONE = '#3EBD93',
  IN_PROCESS = '#3498DB',
  // CLOSED = '#8E44AD',
  CLOSED = '#FF5252',
  // TODO = '#95A5A6',
  TODO = '#9B59B6',
  ON_HOLD = '#607D8B',
  BLOCKED = '#FF5722',
  BLACKLIST = '#D32F2F',
  PROBLEM = '#FF5722',
  POSTED = '#3EBD93',
  PAID = '#3EBD93',
  APPROVED = '#3EBD93',
  PENDING = '#d4940d',
  REJECTED = '#ef4444',
  SETTLED = '#5dadd0',
  CONFIRMED = '#5dadd0',
  PROCESS_REFUND = '#d7a29a',
  REFUNDED = '#fe725e',
}

export const STATUS_DATA_OPTIONS = [
  {
    label: capitalizeEachWord(STATUS_DATA.DRAFT.split('_').join(' ')),
    value: STATUS_DATA.DRAFT,
    color: STATUS_DATA_COLOR.DRAFT,
  },

  {
    label: capitalizeEachWord(STATUS_DATA.ON_HOLD.split('_').join(' ')),
    value: STATUS_DATA.ON_HOLD,
    color: STATUS_DATA_COLOR.ON_HOLD,
  },

  {
    label: capitalizeEachWord(STATUS_DATA.OPEN.split('_').join(' ')),
    value: STATUS_DATA.OPEN,
    color: STATUS_DATA_COLOR.OPEN,
  },

  {
    label: capitalizeEachWord(STATUS_DATA.TODO.split('_').join(' ')),
    value: STATUS_DATA.TODO,
    color: STATUS_DATA_COLOR.TODO,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.IN_PROCESS.split('_').join(' ')),
    value: STATUS_DATA.IN_PROCESS,
    color: STATUS_DATA_COLOR.IN_PROCESS,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.WAITING.split('_').join(' ')),
    value: STATUS_DATA.WAITING,
    color: STATUS_DATA_COLOR.WAITING,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.REQUESTED.split('_').join(' ')),
    value: STATUS_DATA.REQUESTED,
    color: STATUS_DATA_COLOR.REQUESTED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.BLOCKED.split('_').join(' ')),
    value: STATUS_DATA.BLOCKED,
    color: STATUS_DATA_COLOR.BLOCKED,
  },

  {
    label: capitalizeEachWord(STATUS_DATA.PROBLEM.split('_').join(' ')),
    value: STATUS_DATA.PROBLEM,
    color: STATUS_DATA_COLOR.PROBLEM,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.CANCEL.split('_').join(' ')),
    value: STATUS_DATA.CANCEL,
    color: STATUS_DATA_COLOR.CANCEL,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.CLOSED.split('_').join(' ')),
    value: STATUS_DATA.CLOSED,
    color: STATUS_DATA_COLOR.CLOSED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.DELETED.split('_').join(' ')),
    value: STATUS_DATA.DELETED,
    color: STATUS_DATA_COLOR.DELETED,
  },

  {
    label: capitalizeEachWord(STATUS_DATA.INACTIVE.split('_').join(' ')),
    value: STATUS_DATA.INACTIVE,
    color: STATUS_DATA_COLOR.INACTIVE,
  },

  {
    label: capitalizeEachWord(STATUS_DATA.BLACKLIST.split('_').join(' ')),
    value: STATUS_DATA.BLACKLIST,
    color: STATUS_DATA_COLOR.BLACKLIST,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.DECLINE.split('_').join(' ')),
    value: STATUS_DATA.DECLINE,
    color: STATUS_DATA_COLOR.DECLINE,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.APPROVED.split('_').join(' ')),
    value: STATUS_DATA.APPROVED,
    color: STATUS_DATA_COLOR.APPROVED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.ACTIVE.split('_').join(' ')),
    value: STATUS_DATA.ACTIVE,
    color: STATUS_DATA_COLOR.ACTIVE,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.DONE.split('_').join(' ')),
    value: STATUS_DATA.DONE,
    color: STATUS_DATA_COLOR.DONE,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.POSTED.split('_').join(' ')),
    value: STATUS_DATA.POSTED,
    color: STATUS_DATA_COLOR.POSTED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.PAID.split('_').join(' ')),
    value: STATUS_DATA.PAID,
    color: STATUS_DATA_COLOR.PAID,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.PENDING.split('_').join(' ')),
    value: STATUS_DATA.PENDING,
    color: STATUS_DATA_COLOR.PENDING,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.REJECTED.split('_').join(' ')),
    value: STATUS_DATA.REJECTED,
    color: STATUS_DATA_COLOR.REJECTED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.REJECTED.split('_').join(' ')),
    value: STATUS_DATA.REJECTED,
    color: STATUS_DATA_COLOR.REJECTED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.SETTLED.split('_').join(' ')),
    value: STATUS_DATA.SETTLED,
    color: STATUS_DATA_COLOR.SETTLED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.CONFIRMED.split('_').join(' ')),
    value: STATUS_DATA.CONFIRMED,
    color: STATUS_DATA_COLOR.CONFIRMED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.PROCESS_REFUND.split('_').join(' ')),
    value: STATUS_DATA.PROCESS_REFUND,
    color: STATUS_DATA_COLOR.PROCESS_REFUND,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.PROCESS_REFUND_WAHANA.split('_').join(' ')),
    value: STATUS_DATA.PROCESS_REFUND_WAHANA,
    color: STATUS_DATA_COLOR.PROCESS_REFUND,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.REFUNDED.split('_').join(' ')),
    value: STATUS_DATA.REFUNDED,
    color: STATUS_DATA_COLOR.REFUNDED,
  },
  {
    label: capitalizeEachWord(STATUS_DATA.PARTIAL_REFUND.split('_').join(' ')),
    value: STATUS_DATA.PARTIAL_REFUND,
    color: STATUS_DATA_COLOR.REFUNDED,
  },
];

export function makeColorStatus(status: STATUS_DATA): STATUS_DATA_COLOR | undefined {
  const color = STATUS_DATA_OPTIONS.find(
    (item) => item.value?.split('_').join('') === status?.split('_').join('').toLowerCase(),
  );
  return color?.color;
}
