import { schema as s } from '@kbn/config-schema' ; const fieldSchema = s . string ( ) ; export const sortOrderSchema = s . oneOf ( [ s . literal ( 'asc' ) , s . literal ( 'desc' ) , s . literal ( '_doc' ) ] ) ; const sortModeSchema = s . oneOf ( [ s . literal ( 'min' ) , s . literal ( 'max' ) , s . literal ( 'sum' ) , s . literal ( 'avg' ) , s . literal ( 'median' ) , ] ) ; const fieldSortSchema = s . object ( { missing : s . maybe ( s . oneOf ( [ s . string ( ) , s . number ( ) , s . boolean ( ) ] ) ) , mode : s . maybe ( sortModeSchema ) , order : s . maybe ( sortOrderSchema ) , } ) ; const sortContainerSchema = s . recordOf ( s . string ( ) , s . oneOf ( [ sortOrderSchema , fieldSortSchema ] ) ) ; const sortCombinationsSchema = s . oneOf ( [ fieldSchema , sortContainerSchema ] ) ; export const sortSchema = s . oneOf ( [ sortCombinationsSchema , s . arrayOf ( sortCombinationsSchema ) ] ) ;