import { PaginatedResponse } from '@edr/types';
import { FindManyOptions } from 'typeorm';
import { ListWeightLimitRulesQueryDto } from '../dto/list-rule-engine-query.dto';
import { WeightLimitRule } from '../entities/weight-limit-rule.entity';

export interface IWeightLimitRulesRepository {
  findById(id: string): Promise<WeightLimitRule | null>;
  findActiveByContainerTypeId(
    containerTypeId: string,
    tradeDirection: string,
  ): Promise<WeightLimitRule[]>;
  findByPattern(
    containerTypeId: string,
    tradeDirection: string,
    excludeId?: string,
  ): Promise<WeightLimitRule | null>;
  findAll(options?: FindManyOptions<WeightLimitRule>): Promise<WeightLimitRule[]>;
  findAndCount(options?: FindManyOptions<WeightLimitRule>): Promise<[WeightLimitRule[], number]>;
  findPaged(query: ListWeightLimitRulesQueryDto): Promise<PaginatedResponse<WeightLimitRule>>;
  create(data: Partial<WeightLimitRule>): Promise<WeightLimitRule>;
  update(id: string, data: Partial<WeightLimitRule>): Promise<WeightLimitRule | null>;
  softDelete(id: string): Promise<void>;
}

export const WEIGHT_LIMIT_RULES_REPOSITORY = Symbol('WEIGHT_LIMIT_RULES_REPOSITORY');
