import routes from "@/routes";
import { AuthPayload } from "../types";
import { getAuthHeaders } from "../utils";

export interface Payload extends AuthPayload {
    zodiac: string;
}

export interface Response {
  zodiac: Zodiac;
}

export interface Zodiac {
  sign: string;
  metas: ZodiacMeta[];
  aurapic: string | null;
  paragraphs: ZodiacParagraph[];
}

export interface ZodiacMeta {
  value: number;
  label: string;
}

export interface ZodiacParagraph {
  title: string;
  content: string[] | ZodiacParagraph[];
}

export const createRequest = ({ zodiac, token }: Payload): Request => {
  const url = new URL(routes.server.zodiacs(zodiac));
  return new Request(url, { method: "GET", headers: getAuthHeaders(token) });
};
