import payloadHeader from "./payloadHeader"

export default (props = {}) => {
  const header = payloadHeader({
    ...props,
    ...{ _type: "user" },
  })
  return {
    ...header,
    _source: {
      _id: props._id || null,
      firstname: props.firstname || null,
      lastname: props.lastname || null,
      nickname: props.nickname || null,
      email: props.email || null,
      organisation: props.organisation || null, // Type organization
      active: props.active || false,
      tags: props.tags || [],
      avatar: props.avatar || {
        file: null,
        mimetype: null,
        size: 0,
        originalName: null,
      },
    },
  }
}
