import api from 'src/config/api';
import { type Segmentation } from 'src/types/segmentation';
import { addAudienceHeader } from 'src/utils/segmentationUtils';

export const getSegmentationGroups = (
  withUsersCount = false,
  useAudienceApi = false,
) =>
  api.get<Segmentation[]>('/segmentation-groups', {
    params: { withUsersCount: withUsersCount.toString() },
    headers: addAudienceHeader(useAudienceApi),
  });

export const getUserSegmentations = (userId: number) =>
  api.get(`/users/${userId}/segmentations`);
