import { combineRgb } from '@companion-module/base' import type { MPinstance } from './main.js' const colorGreenMP = [88, 201, 23] export function UpdateFeedbacks(self: MPinstance): void { self.setFeedbackDefinitions({ color_task: { name: 'Color Task', type: 'advanced', options: [ { type: 'textinput', label: 'UUID', id: 'uuid', default: '', isVisible: () => (false), } ], callback: (feedback) => { const uuid = feedback.options.uuid const colorStr = self.getVariableValue(`tl_${uuid}_color`) // string "16750848" if (typeof colorStr === 'string') { const bgColor = parseInt(colorStr, 10) return { bgcolor: bgColor, } } return {} }, }, color_cue: { name: 'Color Cue', type: 'advanced', options: [ { type: 'textinput', label: 'UUID', id: 'uuid', default: '', isVisible: () => (false), } ], callback: (feedback) => { const uuid = feedback.options.uuid const colorStr = self.getVariableValue(`cue_${uuid}_color`) // string "16750848" if (typeof colorStr === 'string') { const bgColor = parseInt(colorStr, 10) return { bgcolor: bgColor, } } return {} }, }, current_Cue: { name: 'PlayList Current Cue', type: 'boolean', defaultStyle: { bgcolor: combineRgb(255, 0, 0), color: combineRgb(0, 0, 0), }, options: [ { id: 'current_Cue', type: 'number', label: 'ID', default: 1, min: 1, max: 10000, }, { id: 'pl', type: 'textinput', label: 'Playlist UUID', default: '', isVisible: () => (false), }, ], callback: (feedback) => { if (self.states[`pl_${feedback.options.pl}_currentIndex`] === feedback.options.current_Cue) { return true } else { return false } }, }, status: { name: 'Modulo Player Status', type: 'boolean', defaultStyle: { bgcolor: combineRgb(colorGreenMP[0], colorGreenMP[1], colorGreenMP[2]), }, options: [ { id: 'status', type: 'number', label: 'Modulo Player Status', default: 0, min: 0, max: 2, }, ], callback: (feedback) => { if (feedback.options.status === self.states[`status`]) { return true } else { return false } }, }, master: { name: 'Modulo Player Master', type: 'boolean', defaultStyle: { text: 'Master', bgcolor: combineRgb(255, 0, 0), color: combineRgb(0, 0, 0), }, options: [ { id: 'master', type: 'number', label: 'Master', default: 1, min: 0, max: 1, }, ], callback: async (feedback) => { if (feedback.options.master === self.states[`master`]) { return true } else { return false } }, }, }) }