import type { z } from "zod"

import type { RouterOutput } from "@/lib/trpc/client"
import type {
  creditCardSchema,
  friendsMembershipSchema,
  getUserSchema,
  sasMembershipSchema,
  userLoyaltySchema,
} from "@/server/routers/user/output"
import type { getFriendsMembership } from "@/utils/user"

/**
 * All extended field needs to be added by API team to response or
 * we have to get the values from elsewhere
 */
export interface User extends z.output<typeof getUserSchema> {}

export type SafeUser = RouterOutput["user"]["getSafely"]

export type CreditCard = z.output<typeof creditCardSchema>

export type UserLoyalty = z.output<typeof userLoyaltySchema>

export type Membership = UserLoyalty["memberships"][number]
export type NativeFriendsMembership = z.output<typeof friendsMembershipSchema>
export type EurobonusMembership = z.output<typeof sasMembershipSchema>

export type FriendsMembership = ReturnType<typeof getFriendsMembership>

export type EurobonusTier = EurobonusMembership["tier"]
export type FriendsTier = NativeFriendsMembership["tier"]
