declare module '@shopstack/cc-core-lib/core' {
  import type { Mock } from 'jest-mock';

  // Mocked classes
  export class BaseSchema {
    constructor(definition?: any, options?: any);
    _id: any;
    id: string;
    created_at: Date;
    updated_at: Date;
    created_by: string;
    updated_by: string;
    is_deleted: boolean;
    is_active: boolean;
    save: () => Promise<this>;
    add: Mock;
    pre: Mock;
    post: Mock;
    plugin: Mock;
    index: Mock;
    set: Mock;
    virtual: Mock;
    path: Mock;
  }

  export class BasePipelineProvider {
    constructor();
    init(settings: any): Promise<string>;
    process(data: any): Promise<any>;
    queue(data: any): Promise<any>;
  }

  export class BaseService<T = any> {
    code: string;
    protected model: any;
    static prefix: string;
    constructor(cls: any, model: any);
    find(query: any): Promise<T[]>;
    findOne(query: any, field?: string[], ignore?: any): Promise<T>;
    findById(id: string): Promise<T>;
    findByIdAndUpdate(id: string, update: any, options?: any): Promise<T>;
    findOneAndUpdate(query: any, update: any, options?: any): Promise<T>;
    create(data: any): Promise<T>;
    update(id: string, data: any): Promise<T>;
    delete(id: string): Promise<any>;
  }

  export class BaseModuleSettingService {
    code: string;
    protected setting: any;
    cls: any;
    constructor(code: string, setting: any, cls: any);
    init(): Promise<string>;
    getSetting(key?: string): Promise<any>;
    setSetting(data: any, key?: string): Promise<any>;
    defaultPermission(): Promise<any>;
    setPermission(permission: any): Promise<any[]>;
    getModuleConfig(): Promise<any>;
    updateModuleConfig(config: any): Promise<any>;
    getScheduleConfig(): Promise<any>;
    updateScheduleConfig(config: any): Promise<any>;
  }

  export interface IModuleSetting {
    defaultPermission(): Promise<any>;
    setPermission(permission: any): Promise<any[]>;
    getSetting(key?: string): Promise<any>;
    setSetting(data: any, key?: string): Promise<any>;
  }

  export interface PipelineExecuteDto {
    [key: string]: any;
  }

  export const CONST: {
    CUSTOM_PROVIDERS: any[];
    IGNORE_ENTITY: any[];
  };

  export const BaseSchemaFactory: {
    createForClass: Mock<any, [any]>;
  };

  export const callAddQueueInternal: Mock<Promise<boolean>, [string, any]>;
  export const callCountInternalService: Mock<Promise<number>, [string, any]>;
  export const callFindInternalService: Mock<Promise<any>, [string, string?, any?, string?, string?, any?]>;
  export const callListInternalService: Mock<Promise<any>, [string, any?, any?]>;
  export const callCreateInternalService: Mock<Promise<any>, [string, any, any?, boolean?]>;
  export const callDeleteInternalService: Mock<Promise<any>, [string, string]>;
  export const callBulkDeleteInternalService: Mock<Promise<any>, [string, string[]]>;
  export const callBulkUpdateInternalService: Mock<Promise<any>, [string, any[]]>;
  export const callUpdateInternalService: Mock<Promise<any>, [string, string, any]>;
  export const callInternalService: Mock<Promise<any>, [string, string, any?, any?]>;
  export const callGetInternalService: Mock<Promise<any>, [string, string]>;

  export const transformString: Mock<string, [string, any]>;
  export const executeFunc: Mock<string, [string, any, any]>;
  export const generateRunningNumber: Mock<string, [string, string, number]>;
  export const loadEntity: Mock<Promise<any>, [string]>;
  export const getNextExecuteTime: Mock<Date, []>;
  export const transform: Mock<any, [any]>;
  export const generateOtp: Mock<Promise<string>, []>;
  export const validateOtp: Mock<Promise<boolean>, [string, string]>;
  export const initQueue: Mock<Promise<boolean>, [string, any]>;
  export const randomString: Mock<string, [number?]>;
  export const convertConditionToMongoQuery: Mock<any, [any]>;
  export const addSystemSchedule: Mock<void, [any]>;

  export interface SearchResultDto {
    rows: any[];
    total: number;
    page: number;
    limit: number;
  }

  export class EntitiesService {
    refreshSystemSchema: Mock<Promise<boolean>, [any, any, any, any, any?]>;
  }

  export class SettingService {
    getSetting: Mock<Promise<any>, [string?]>;
    setSetting: Mock<Promise<any>, [any, string?]>;
  }

  export const UserPermission: {
    creator: string;
    viewer: string;
    access_denied: string;
  };

  export const PointProgramRuleType: {
    BIRTHDAY: string;
    SPEND: string;
    FIXED: string;
    QR_SCAN: string;
    GAME_REWARD: string;
    SIGNUP: string;
  };

  export interface LayoutEntity {
    name: string;
    code: string;
    type: string[];
    detail: any;
    list?: any;
    allow_workflow_actions?: boolean;
    [key: string]: any; // Allow additional properties
  }

  export interface WorkflowEntity {
    [key: string]: any; // Allow any properties for workflow
  }

  export class BaseController {
    constructor(service: any);
  }

  // Decorators
  export const Basic: () => (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
  export const Public: () => (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => any;
}