import * as apid from '../../../api' ; import Reserve from '../../db/entities/Reserve' ; import { IReserveUpdateValues } from '../event/IReserveEvent' ; export interface IFindReserveOption { hasSkip : boolean ; hasConflict : boolean ; hasOverlap : boolean ; } export interface IReserveTimeOption { startAt : apid . UnixtimeMS ; endAt : apid . UnixtimeMS ; } export interface IFindTimeRangesOption extends IFindReserveOption { times : IReserveTimeOption [ ] ; excludeRuleId ? : apid . RuleId ; excludeReserveId ? : apid . ReserveId ; } export interface IFindRuleOption extends IFindReserveOption { ruleId : apid . RuleId ; } export interface IGetManualIdsOption { hasTimeReserve : boolean ; } export interface IFindTimeSpecificationOption { channelId : apid . ChannelId ; startAt : apid . UnixtimeMS ; endAt : apid . UnixtimeMS ; } export interface RuleIdCountResult { ruleId : apid . RuleId ; ruleIdCnt : number ; } export default interface IReserveDB { restore ( items ) : Promise < void > ; insertOnce ( reserve ) : Promise < apid . ReserveId > ; updateOnce ( reserve ) : Promise < void > ; updateMany ( values ) : Promise < void > ; findId ( reserveId ) : Promise < Reserve | null > ; findAll ( option ) : Promise < [ Reserve [ ] , number ] > ; findLists ( option ? ) : Promise < Reserve [ ] > ; findProgramId ( programId ) : Promise < Reserve [ ] > ; findTimeRanges ( option ) : Promise < Reserve [ ] > ; findRuleId ( option ) : Promise < Reserve [ ] > ; findOldTime ( baseTime ) : Promise < Reserve [ ] > ; findTimeSpecification ( option ) : Promise < Reserve | null > ; getManualIds ( option ) : Promise < apid . ReserveId [ ] > ; countRuleIds ( ruleIds , type ) : Promise < RuleIdCountResult [ ] > ; }