export function createItem(overrides = {}, withSecondary = true, isTimeline = false) {
  if (isTimeline) {
    return {
      lines: [],
      title: "New title",
      max_items: 5,
      group_title: ""
    }
  }

  let data = {
    title: "New Item",
    description: "New description",
    public: false,
    featured_image: "",
    primary_button: {
      show: false,
      label: "",
      type: "site-content",
      url: '',
      open_in_new_tab: false,
    ...(overrides.primary_button || {}),
    },
  }
  if (!withSecondary) {
    data.primary_button.name = 'Linked to';
  }

  if (withSecondary) {
    data.secondary_button = {
      show: false,
      label: "",
      type: "site-content",
      url: '',
      open_in_new_tab: false,
      ...(overrides.secondary_button || {}),
    };
  }

  return {
    ...data,
    ...overrides,
  };
}

export function createLink(overrides = {}, type = null) {
  if (type === 'faqs' || type === 'pricing') {
    return {
      has_extra: true,
      as_item: true,
      is_editor: true,
      title: "Item title",
      supporting_text: "Enter your description here.",
    }
  }

  if (type === 'feature_items') {
    return {
      has_extra: true,
      as_item: true,
      title: "Item title",
      icon: "AlertCircle",
      supporting_text: "Enter your description here.",
    }
  }

  if (type === 'bullet_points') {
    return {
      title: "New link",
    };
  }

  return {
    title: "New link",
    url: "",
    open_in_new_tab: true,
    type: "site-content",
    ...(overrides || {}),
  };
}

export function createLogo(overrides = {}) {
  return {
    image: "",
    url: "",
    ...(overrides || {}),
  };
}

export function createTab(overrides = {}) {
  return {
    title: "New tab",
    public: false,
    featured_image: "",
    show_button: true,
    button_label: "View all",
    button_url: "#",
    button_url_type: "site-content",
    button_open_in_new_tab: false,
    ...overrides,
  };
}
