import { object, string } from 'yup'

export const sessionSchema = object().shape({
  title: string().required().min(3),
  courseId: string().required(),
  type: string().oneOf(['offline', 'online']).required(),
  link: string().when('sessionType', {
    is: 'online',
    then: (schema) => schema.required(),
    otherwise: (schema) => schema.nullable().notRequired(),
  }),
  description: string().nullable().notRequired(),
})
