export default {
name: 'referenceObject',
title: 'Reference Object',
type: 'object',
fields: [
{
name: 'type',
title: 'Type',
type: 'string',
options: {
list: [
{ title: 'Movie', value: 'movie'},
{ title: 'Person', value: 'person'},
{ title: 'Screening', value: 'screening'}
]
}
},
{
name: 'movieReference',
type: 'reference',
to: [{ type: 'movie' }],
hidden: ({ parent }) => parent?.type &&
parent?.type == 'movie' ? false : true
},
{
name: 'personReference',
type: 'reference',
to: [{ type: 'person'}],
hidden: ({ parent }) => parent?.type &&
parent?.type == 'person' ? false : true
},
{
name: 'screeningReference',
type: 'reference',
to: [{ type: 'screening'}],
hidden: ({ parent }) => parent?.type &&
parent?.type == 'screening' ? false : true
},
]
}