const Joi = require("joi");

const deviceTokenInputType = Joi.object().keys({
  token: Joi.string().required(),
  country: Joi.string().optional(),
});

/*const pushSendType = Joi.object().keys({
    userIds: Joi.array().required(),
    title: Joi.string().required(),
    message: Joi.string().required(),
    //token: Joi.string().required(),
});*/

const pushSendEvent = Joi.object().keys({
  date: Joi.date().optional(),
  title: Joi.string().required(),
  body: Joi.string().required(),
  recipients: Joi.object().keys({
    userIds: Joi.array().optional(),
    deviceIds: Joi.array().optional(),
    eventId: Joi.string().optional(),
    segment: Joi.string().optional(),
    country: Joi.string().optional(),
  }),
  priority: Joi.string().optional(),
  ttl: Joi.string().optional(),
  data: Joi.object().keys({
    type: Joi.string().required(),
    title: Joi.string().required(),
    message: Joi.string().required(),
    button: Joi.object().keys({
      caption: Joi.string().required(),
      url: Joi.string().optional(),
      screen: Joi.string().optional(),
      paramId: Joi.string().optional(),
    }),
  }),
});

module.exports = {
  deviceTokenInputType,
  pushSendEvent,
};
