/**
 * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
 *
 * Generates Typescript types for analytics events from analytics.spec.yaml
 *
 * @codegen <<SignedSource::f914fb83fac56e7154ef460866628f7d>>
 * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
 */

const createEventPayload = (eventKey, ...[attributes]) => {
  const [eventType, actionSubject, action, actionSubjectId] = eventKey.split('.');
  if (eventType === 'screen') {
    return {
      eventType,
      name: actionSubject,
      action: 'viewed',
      attributes: attributes
    };
  }
  return {
    eventType,
    actionSubject,
    action,
    actionSubjectId,
    attributes: attributes
  };
};
export default createEventPayload;