11import type { JSONBlob } from '@sofie-automation/shared-lib/dist/lib/JSONBlob'
22import type { ITranslatableMessage } from './translations'
3- import type { JSONSchema } from '@sofie-automation/shared-lib/dist/lib/JSONSchemaTypes'
3+ import { JSONSchema } from '@sofie-automation/shared-lib/dist/lib/JSONSchemaTypes'
4+ import { SourceLayerType } from './content'
45
56/**
67 * Description of a user performed editing operation allowed on an document
@@ -16,8 +17,10 @@ export interface UserEditingDefinitionAction {
1617 id : string
1718 /** Label to show to the user for this operation */
1819 label : ITranslatableMessage
19- /** Icon to show to when this action is 'active' */
20+ /** Icon to show when this action is 'active' */
2021 svgIcon ?: string
22+ /** Icon to show when this action is 'disabled' */
23+ svgIconInactive ?: string
2124 /** Whether this action should be indicated as being active */
2225 isActive ?: boolean
2326}
@@ -40,6 +43,53 @@ export interface UserEditingDefinitionForm {
4043export enum UserEditingType {
4144 /** Action */
4245 ACTION = 'action' ,
43- /** Form of selections */
46+ /** Form */
4447 FORM = 'form' ,
4548}
49+
50+ export interface UserEditingSourceLayer {
51+ sourceLayerLabel : string
52+ sourceLayerType : SourceLayerType
53+ schema : JSONBlob < JSONSchema >
54+ defaultValue ?: Record < string , any >
55+ }
56+
57+ export interface UserEditingProperties {
58+ /**
59+ * These properties are dependent on the (primary) piece type, the user will get the option
60+ * to select the type of piece (from the SourceLayerTypes i.e. Camera or Split etc.) and then
61+ * be presented the corresponding form
62+ *
63+ * example:
64+ * {
65+ * schema: {
66+ * camera: '{ "type": "object", "properties": { "input": { "type": "number" } } }',
67+ * split: '{ "type": "object", ... }',
68+ * },
69+ * currentValue: {
70+ * type: 'camera',
71+ * value: {
72+ * input: 3
73+ * },
74+ * }
75+ * }
76+ */
77+ pieceTypeProperties ?: {
78+ schema : Record < string , UserEditingSourceLayer >
79+ currentValue : { type : string ; value : Record < string , any > }
80+ }
81+
82+ /**
83+ * These are properties that are available to edit regardless of the piece type, examples
84+ * could be whether it an element is locked from NRCS updates
85+ *
86+ * if you do not want the piece type to be changed, then use only this field.
87+ */
88+ globalProperties ?: { schema : JSONBlob < JSONSchema > ; currentValue : Record < string , any > }
89+
90+ /**
91+ * A list of id's of operations to be exposed on the properties panel as buttons. These operations
92+ * must be available on the element
93+ */
94+ operations ?: UserEditingDefinitionAction [ ]
95+ }
0 commit comments