// Auto-generated types for actions module
import type {
  ActionItem,
  ActionsModel,
  languageSchema,
} from "@folo-services/drizzle"
import type z from "zod"

import type { EmptyResponse, StructuredSuccessResponse } from "../../types"

// Re-export database types
export type { ActionItem, ActionsModel } from "@folo-services/drizzle"

// Actions API request/response types
export type ActionsGetResponse = StructuredSuccessResponse<ActionsModel | null>

export interface ActionsPutRequest {
  rules: ActionItem[]
}

export type ActionsPutResponse = EmptyResponse

export type SupportedLanguages = z.infer<typeof languageSchema>

export type ActionId = Exclude<keyof ActionItem["result"], "disabled" | "blockRules">
export type ActionFilterItem = Partial<
  Exclude<ActionItem["condition"][number], { length: number }>
>
export type ActionFeedField = Exclude<ActionFilterItem["field"], undefined>
export type ActionOperation = Exclude<ActionFilterItem["operator"], undefined>

export type ActionConditionIndex = {
  ruleIndex: number
  groupIndex: number
  conditionIndex: number
}
