import type { Currency, ExchangeRate, Schema, UoMCategory, Unit } from "../lib/types";

export const baseUoMCategory = {
  id: "category-1",
  name: "Weight",
  description: "Weight units",
  referenceUnitId: "unit-kg",
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies UoMCategory<Schema>;

export const baseUnitKg = {
  id: "unit-kg",
  name: "Kilogram",
  symbol: "kg",
  categoryId: "category-1",
  conversionFactor: 1.0,
  roundingPrecision: 2,
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Unit<Schema>;

export const baseUnitGram = {
  id: "unit-g",
  name: "Gram",
  symbol: "g",
  categoryId: "category-1",
  conversionFactor: 0.001,
  roundingPrecision: 0,
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Unit<Schema>;

export const baseUnitPound = {
  id: "unit-lb",
  name: "Pound",
  symbol: "lb",
  categoryId: "category-1",
  conversionFactor: 0.453592,
  roundingPrecision: 2,
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Unit<Schema>;

export const baseUnitLiter = {
  id: "unit-l",
  name: "Liter",
  symbol: "L",
  categoryId: "category-2",
  conversionFactor: 1.0,
  roundingPrecision: 2,
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Unit<Schema>;

export const inactiveUnit = {
  id: "unit-inactive",
  name: "Inactive Unit",
  symbol: "iu",
  categoryId: "category-1",
  conversionFactor: 1.0,
  roundingPrecision: 2,
  isActive: false,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Unit<Schema>;

// Currency fixtures
export const baseCurrencyUSD = {
  id: "currency-usd",
  code: "USD",
  name: "US Dollar",
  symbol: "$",
  decimalPlaces: 2,
  isBaseCurrency: true,
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Currency<Schema>;

export const baseCurrencyEUR = {
  id: "currency-eur",
  code: "EUR",
  name: "Euro",
  symbol: "€",
  decimalPlaces: 2,
  isBaseCurrency: false,
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Currency<Schema>;

export const baseCurrencyJPY = {
  id: "currency-jpy",
  code: "JPY",
  name: "Japanese Yen",
  symbol: "¥",
  decimalPlaces: 0,
  isBaseCurrency: false,
  isActive: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Currency<Schema>;

export const inactiveCurrency = {
  id: "currency-inactive",
  code: "XXX",
  name: "Inactive Currency",
  symbol: "X",
  decimalPlaces: 2,
  isBaseCurrency: false,
  isActive: false,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Currency<Schema>;

// ExchangeRate fixtures
export const baseExchangeRateUSDtoEUR = {
  id: "rate-usd-eur-1",
  sourceCurrencyId: "currency-usd",
  targetCurrencyId: "currency-eur",
  rate: 0.92,
  effectiveDate: new Date("2024-01-15T00:00:00.000Z"),
  createdAt: new Date("2024-01-15T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ExchangeRate<Schema>;

export const baseExchangeRateUSDtoJPY = {
  id: "rate-usd-jpy-1",
  sourceCurrencyId: "currency-usd",
  targetCurrencyId: "currency-jpy",
  rate: 148.5,
  effectiveDate: new Date("2024-01-15T00:00:00.000Z"),
  createdAt: new Date("2024-01-15T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ExchangeRate<Schema>;

export const olderExchangeRateUSDtoEUR = {
  id: "rate-usd-eur-old",
  sourceCurrencyId: "currency-usd",
  targetCurrencyId: "currency-eur",
  rate: 0.85,
  effectiveDate: new Date("2024-01-01T00:00:00.000Z"),
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ExchangeRate<Schema>;

export const baseExchangeRateEURtoUSD = {
  id: "rate-eur-usd-1",
  sourceCurrencyId: "currency-eur",
  targetCurrencyId: "currency-usd",
  rate: 1.087,
  effectiveDate: new Date("2024-01-15T00:00:00.000Z"),
  createdAt: new Date("2024-01-15T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ExchangeRate<Schema>;
