export interface Rules {
  field: string;
  operator:
    | "is"
    | "is not"
    | "is blank"
    | "is not blank"
    | "contains"
    | "does not contain"
    | "starts with"
    | "ends with"
    | "is any"
    | "is during the current"
    | "is during the previous"
    | "is during the next"
    | "is before the previous"
    | "is after the next"
    | "is before"
    | "is after"
    | "is today"
    | "is today or before"
    | "is today or after"
    | "is before today"
    | "is after today"
    | "is before current time"
    | "is after current time"
    | "higher than"
    | "lower than"
    | "near";
  value?: string;
  range?: number;
  type?: string;
}

export interface Filters {
  match: "and" | "or";
  rules: Rules[];
}

export interface Sort {
  field: string;
  order: "asc" | "desc";
}

export interface getSettings {
  objectKey: string;
  recordId?: string;
  filters?: Filters;
  sort?: Sort[] | Sort;
  debug?: boolean;
  page?: number;
  rowsPerPage?: number;
  method?: string;
  attempts?: number;
  recordLimit?: number;
  format?: "html" | "raw" | "both";
  requestId?: string;
  factory?: any;
  host?: string;
}

export interface putSettings {
  objectKey: string;
  recordId: string;
  payload: any;
  debug?: boolean;
  attempts?: number;
  method?: string;
  requestId?: string;
  factory?: any;
  host?: string;
}

export interface postSettings {
  objectKey: string;
  payload: any;
  debug?: boolean;
  attempts?: number;
  method?: string;
  requestId?: string;
  factory?: any;
  host?: string;
}

export interface deleteSettings {
  objectKey: string;
  recordId: string;
  debug?: boolean;
  attempts?: number;
  method?: string;
  requestId?: string;
  factory?: any;
  host?: string;
}

export interface State {
  objectKey: string;
  recordId: string;
  wait: number;
  attempts: number;
  page: number;
  additions: string[];
  rowsPerPage: number;
  failed: boolean;
  records: any[];
  combined: any;
}
