define(["exports","./../modules/common/itemmanager/itemmanager.js","./../modules/common/itemmanager/baseitemcontroller.js","./../modules/common/datetime.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/common/globalize.js"],function(_exports,_itemmanager,_baseitemcontroller,_datetime,_connectionmanager,_globalize){function ScheduledTaskTriggerController(){_baseitemcontroller.default.apply(this,arguments)}function getDisplayTime(ticks){var ticks=ticks/1e4,now=new Date;return now.setHours(0,0,0,0),now.setTime(now.getTime()+ticks),_datetime.default.getDisplayTime(now)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(ScheduledTaskTriggerController.prototype,_baseitemcontroller.default.prototype),ScheduledTaskTriggerController.prototype.getTypeNames=function(){return["ScheduledTaskTrigger"]},ScheduledTaskTriggerController.prototype.getDisplayName=function(item,options){return"DailyTrigger"===(triggerType=(item=item).TriggerType)?"Daily at "+getDisplayTime(item.TimeOfDayTicks):"WeeklyTrigger"===triggerType?item.DayOfWeek+"s at "+getDisplayTime(item.TimeOfDayTicks):"SystemEventTrigger"===triggerType&&"WakeFromSleep"===item.SystemEvent?"On wake from sleep":"IntervalTrigger"===triggerType?.25==(item=item.IntervalTicks/36e9)?"Every 15 minutes":.5==item?"Every 30 minutes":.75==item?"Every 45 minutes":1==item?"Every hour":"Every "+item+" hours":"StartupTrigger"===triggerType?"On server startup":triggerType;var triggerType},ScheduledTaskTriggerController.prototype.isSingleItemFetchRequired=function(typeName){return!1},ScheduledTaskTriggerController.prototype.getDefaultIcon=function(item){return"&#xe855;"},ScheduledTaskTriggerController.prototype.canDelete=function(item,user){return!0},ScheduledTaskTriggerController.prototype.enableLibraryItemDeleteConfirmation=function(){return!1},ScheduledTaskTriggerController.prototype.canRate=function(item){return!1},ScheduledTaskTriggerController.prototype.canMarkPlayed=function(item){return!1},ScheduledTaskTriggerController.prototype.canAddToPlaylist=function(item){return!1},ScheduledTaskTriggerController.prototype.canAddToCollection=function(item,user){return!1},ScheduledTaskTriggerController.prototype.canConvert=function(item,user){return!1},ScheduledTaskTriggerController.prototype.canEdit=function(item,user){return!1},ScheduledTaskTriggerController.prototype.canEditImages=function(item,user){return!1},ScheduledTaskTriggerController.prototype.canEditSubtitles=function(item,user){return!1},ScheduledTaskTriggerController.prototype.getEditCommandText=function(item){return _globalize.default.translate("Edit")},ScheduledTaskTriggerController.prototype.isDeletePrimaryCommand=function(itemType){return!0},ScheduledTaskTriggerController.prototype.getDeleteMessages=function(){return{single:{text:"MessageDeleteTaskTrigger",title:_globalize.default.translate("HeaderDeleteTaskTrigger"),confirmText:_globalize.default.translate("Delete")},plural:{text:"MessageDeleteTaskTrigger",title:_globalize.default.translate("HeaderDeleteTaskTrigger"),confirmText:_globalize.default.translate("Delete")}}},ScheduledTaskTriggerController.prototype.canRefreshMetadata=function(item,user){return!1},ScheduledTaskTriggerController.prototype.deleteItemsInternal=function(options){var item=options.items[0],apiClient=_connectionmanager.default.getApiClient(item);return apiClient.getScheduledTask(item.ScheduledTaskId).then(function(task){return task.Triggers.splice(item.TriggerIndex,1),apiClient.updateScheduledTaskTriggers(task.Id,task.Triggers)})},ScheduledTaskTriggerController.prototype.editItems=function(items,options){return Promise.reject()},ScheduledTaskTriggerController.prototype.resolveField=function(item,field){var timeLimitText,hours;return"TaskTriggerTimeLimit"!==field?_baseitemcontroller.default.prototype.resolveField.apply(this,arguments):(timeLimitText="",item.MaxRuntimeTicks&&(timeLimitText+=1==(hours=item.MaxRuntimeTicks/36e9)?_globalize.default.translate("ValueTimeLimitSingleHour"):_globalize.default.translate("ValueTimeLimitMultiHour",hours)),timeLimitText)};var instance=new ScheduledTaskTriggerController;_itemmanager.default.registerItemController(instance),_exports.default=instance});