export const SEQ_SIZES = {
  participant: { w: 160, h: 60 },
  fragment: { w: 0, h: 0 }, // Computed dynamically from contained messages
} as const;

export const SEQ_LAYOUT = {
  participantSpacing: 200,
  messageStartY: 100,
  messageSpacing: 50,
  lifelinePadding: 40,
  activationWidth: 12,
  fragmentPadding: 16,
} as const;

export function resolveSequenceNodeType(type: string): string {
  const bare = type.startsWith("seq:") ? type.slice(4) : type;
  switch (bare) {
    case "participant":
      return "seqParticipant";
    case "fragment":
      return "seqFragment";
    default:
      return "seqParticipant";
  }
}

export function resolveSequenceEdgeType(type: string | undefined): string {
  switch (type) {
    case "sync":
      return "seqSync";
    case "async":
      return "seqAsync";
    case "return":
      return "seqReturn";
    default:
      return "seqSync";
  }
}

export function getSeqNodeSize(
  flowType: string | undefined,
): { w: number; h: number } | null {
  switch (flowType) {
    case "seqParticipant":
      return SEQ_SIZES.participant;
    default:
      return null;
  }
}
