/**
 * 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::268e746266cde1271e40a794eb774cf3>>
 * @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: eventType,
      name: actionSubject,
      action: 'viewed',
      attributes: attributes
    };
  }
  return {
    eventType: eventType,
    actionSubject: actionSubject,
    action: action,
    actionSubjectId: actionSubjectId,
    attributes: attributes
  };
};
export default createEventPayload;