import type { SellerLookupInput } from "./types"
import type { Seller } from "../../models/seller/Seller"

import instance from "../axiosInstance"
import { mapSellerFromLookupResponse } from "../../adapters/responses/sellerFromLookupAdapter"
import { endpoints } from "@shared/contracts"

const { seller } = endpoints

export async function lookupSellerFromLink(
  input: SellerLookupInput
): Promise<Seller | null> {
  const { data } = await instance.post("/seller/from-link", input)
  const parsed = seller.sellerLookupResponseSchema.parse(data)
  return mapSellerFromLookupResponse(parsed)
}

