import * as SegmentTypes from "./segments.d";
import { FilteredResponse } from "./sdkResponse";

export interface ConnectionData { // object with connection details for unomi/elasticsearch
    urlUnomi: string;
    urlElasticsearch: string;
    auth: {
        username?: string;
        password?: string;
        bearerToken?: string;
    };
}

export interface Connection { // all functions that can be used
    profile: {
        get: (profileId: string) => FilteredResponse,
        allUsedProperties: () => FilteredResponse,
        count: () => FilteredResponse
    },
    segment: {
        getAll: (sortOrder: string, limit: number, offset: number) => FilteredResponse,
        get: (segmentId: string) => FilteredResponse,
        create: (params: SegmentTypes.UsedProperties) => FilteredResponse,
        update: (params: SegmentTypes.UsedProperties) => FilteredResponse,
        delete: (segmentId: string) => FilteredResponse,
        profileCount: (params: SegmentTypes.SegmentProfileCountProperties) => FilteredResponse
    },
    rule: {
        getAll: () => FilteredResponse,
        get: (ruleId: string) => FilteredResponse,
        create: (params: object) => FilteredResponse
    },
    comparisonOperator: {
        getAll: () => FilteredResponse
    },
    matchType: {
        getAll: () => FilteredResponse
    }
    dateExpression: {
        isValid: (dateExpr: string) => boolean
    }
}