import {JSONSchema7} from 'json-schema'; export default { $id: 'https://schemas.coastapp.com/card/v1/actions.json', $schema: 'http://json-schema.org/draft-07/schema', title: 'Actions', type: 'array', items: {$ref: '#/definitions/action'}, minItems: 1, definitions: { action: { title: 'Action', anyOf: [ {$ref: '#/definitions/actionUrl'}, {$ref: '#/definitions/actionNavTemplate'}, {$ref: '#/definitions/actionNavContext'}, {$ref: '#/definitions/actionSetValues'}, {$ref: '#/definitions/actionSubmitForm'}, {$ref: '#/definitions/actionToast'}, {$ref: '#/definitions/actionSheet'}, ], }, actionUrl: { title: 'Action External URL', type: 'object', description: 'url or field name is required', additionalProperties: false, properties: { type: {type: 'string', enum: ['actionUrl']}, url: {type: 'string'}, name: {type: 'string'}, }, required: ['type'], }, actionNavTemplate: { title: 'Action Nav Template', type: 'object', additionalProperties: false, properties: { type: {type: 'string', enum: ['actionNavTemplate']}, templateSlug: {type: 'string'}, fieldOverrides: { type: 'object', properties: {}, }, }, required: ['type', 'templateSlug'], }, actionNavContext: { title: 'Action Nav Context', type: 'object', additionalProperties: false, properties: { type: {type: 'string', enum: ['actionNavContext']}, context: {type: 'string', enum: ['edit', 'create', 'detail', 'list', 'agenda', 'kanban']}, fieldOverrides: { type: 'object', properties: {}, }, }, required: ['type', 'context'], }, actionSetValues: { title: 'Action Set Values', type: 'object', additionalProperties: false, properties: { type: {type: 'string', enum: ['actionSetValues']}, values: { title: 'Field Values', type: 'array', items: { title: 'Field Value', type: 'object', additionalProperties: false, properties: { name: {type: 'string'}, value: {}, }, required: ['name', 'value'], }, minItems: 1, }, }, required: ['type', 'values'], }, actionSubmitForm: { title: 'Action Submit Form', type: 'object', additionalProperties: false, properties: { type: {type: 'string', enum: ['actionSubmitForm']}, }, required: ['type'], }, actionToast: { title: 'Action Toast', type: 'object', additionalProperties: false, properties: { type: {type: 'string', enum: ['actionToast']}, toastOptions: { $ref: 'https://schemas.coastapp.com/card/v1/toastOptions.json', }, }, required: ['type'], }, actionSheet: { title: 'Action Sheet', type: 'object', additionalProperties: false, properties: { type: {type: 'string', enum: ['actionSheet']}, options: { title: 'Action Sheet Options', type: 'array', items: { title: 'Action Sheet Option', type: 'object', additionalProperties: false, properties: { label: {type: 'string'}, confirmStyle: { type: 'string', title: 'Action Sheet Option Confirm Style', enum: ['default', 'cancel', 'destructive'], default: 'default', }, selector: { $ref: 'https://schemas.coastapp.com/card/v1/selector.json', }, actions: { title: 'Action Sheet Option Actions', type: 'array', items: { anyOf: [ {$ref: '#/definitions/actionUrl'}, {$ref: '#/definitions/actionNavTemplate'}, {$ref: '#/definitions/actionNavContext'}, {$ref: '#/definitions/actionSetValues'}, {$ref: '#/definitions/actionSubmitForm'}, {$ref: '#/definitions/actionToast'}, ], }, minItems: 1, }, }, required: ['label', 'actions'], }, }, }, required: ['type'], }, }, } as JSONSchema7;