import type {
  BusinessPartner,
  ContactPerson,
  PartnerAddress,
  PartnerBankAccount,
  PartnerIdentification,
  PartnerRole,
  Schema,
} from "../lib/types";

// BusinessPartner fixtures
export const baseDraftPartner = {
  id: "partner-1",
  name: "Acme Corp",
  type: "ORGANIZATION",
  companyId: "company-1",
  preferredCurrencyId: null,
  status: "DRAFT",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies BusinessPartner<Schema>;

export const baseActivePartner = {
  id: "partner-2",
  name: "Global Supplies Inc",
  type: "ORGANIZATION",
  companyId: "company-1",
  preferredCurrencyId: "currency-usd",
  status: "ACTIVE",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies BusinessPartner<Schema>;

export const baseInactivePartner = {
  id: "partner-3",
  name: "Old Vendor Ltd",
  type: "ORGANIZATION",
  companyId: "company-1",
  preferredCurrencyId: null,
  status: "INACTIVE",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies BusinessPartner<Schema>;

export const baseIndividualPartner = {
  id: "partner-4",
  name: "John Doe",
  type: "INDIVIDUAL",
  companyId: "company-1",
  preferredCurrencyId: null,
  status: "ACTIVE",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies BusinessPartner<Schema>;

// PartnerRole fixtures
export const baseCustomerRole = {
  id: "role-1",
  partnerId: "partner-2",
  role: "CUSTOMER",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerRole<Schema>;

export const baseSupplierRole = {
  id: "role-2",
  partnerId: "partner-2",
  role: "SUPPLIER",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerRole<Schema>;

// PartnerAddress fixtures
export const baseBillingAddress = {
  id: "address-1",
  partnerId: "partner-2",
  addressType: "BILLING",
  line1: "123 Main St",
  line2: null,
  city: "New York",
  state: "NY",
  postalCode: "10001",
  country: "US",
  isDefault: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerAddress<Schema>;

export const baseShippingAddress = {
  id: "address-2",
  partnerId: "partner-2",
  addressType: "SHIPPING",
  line1: "456 Oak Ave",
  line2: "Suite 100",
  city: "Los Angeles",
  state: "CA",
  postalCode: "90001",
  country: "US",
  isDefault: false,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerAddress<Schema>;

// ContactPerson fixtures
export const baseActiveContact = {
  id: "contact-1",
  partnerId: "partner-2",
  firstName: "Jane",
  lastName: "Smith",
  email: "jane@example.com",
  phone: "+1-555-0100",
  jobTitle: "Procurement Manager",
  department: "Purchasing",
  isPrimary: true,
  status: "ACTIVE",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ContactPerson<Schema>;

export const baseInactiveContact = {
  id: "contact-2",
  partnerId: "partner-2",
  firstName: "Bob",
  lastName: "Jones",
  email: "bob@example.com",
  phone: null,
  jobTitle: null,
  department: null,
  isPrimary: false,
  status: "INACTIVE",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ContactPerson<Schema>;

export const baseNonPrimaryContact = {
  id: "contact-3",
  partnerId: "partner-2",
  firstName: "Alice",
  lastName: "Williams",
  email: null,
  phone: "+1-555-0200",
  jobTitle: null,
  department: null,
  isPrimary: false,
  status: "ACTIVE",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ContactPerson<Schema>;

// PartnerBankAccount fixtures
export const baseDefaultBankAccount = {
  id: "bank-1",
  partnerId: "partner-2",
  bankName: "First National Bank",
  accountHolderName: "Global Supplies Inc",
  accountNumber: "1234567890",
  routingNumber: "021000021",
  iban: null,
  swiftBic: null,
  currencyId: "currency-usd",
  isDefault: true,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerBankAccount<Schema>;

export const baseSecondBankAccount = {
  id: "bank-2",
  partnerId: "partner-2",
  bankName: "Deutsche Bank",
  accountHolderName: "Global Supplies GmbH",
  accountNumber: null,
  routingNumber: null,
  iban: "DE89370400440532013000",
  swiftBic: "DEUTDEDB",
  currencyId: "currency-eur",
  isDefault: false,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerBankAccount<Schema>;

// PartnerIdentification fixtures
export const baseTaxIdIdentification = {
  id: "ident-1",
  partnerId: "partner-2",
  type: "TAX_ID",
  value: "12-3456789",
  issuingCountry: "US",
  validFrom: null,
  validTo: null,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerIdentification<Schema>;

export const baseVatIdentification = {
  id: "ident-2",
  partnerId: "partner-2",
  type: "VAT",
  value: "DE123456789",
  issuingCountry: "DE",
  validFrom: new Date("2024-01-01"),
  validTo: new Date("2025-12-31"),
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies PartnerIdentification<Schema>;
