import { describe, it, expect } from 'vitest'

describe('entities-published barrel', () => {
  it('exports all base entity Zod schemas', async () => {
    const barrel = await import('../entities-published')

    expect(barrel.BaseProjectSchema).toBeDefined()
    expect(barrel.BaseMilestoneSchema).toBeDefined()
    expect(barrel.BaseTaskSchema).toBeDefined()
    expect(barrel.BaseDealSchema).toBeDefined()
    expect(barrel.BaseCompanySchema).toBeDefined()
    expect(barrel.BaseContactSchema).toBeDefined()
  })

  it('round-trips a valid project through the barrel-exported schema', async () => {
    const { BaseProjectSchema } = await import('../entities-published')

    const validProject = {
      id: '00000000-0000-0000-0000-000000000010',
      organizationId: '00000000-0000-0000-0000-000000000001',
      name: 'Website Rebuild',
      kind: 'client_engagement',
      status: 'active',
      description: 'Rebuild the client website.',
      metadata: { budget: 50000 },
      createdAt: '2026-04-17T00:00:00.000Z',
      updatedAt: '2026-04-17T00:00:00.000Z'
    }

    const result = BaseProjectSchema.safeParse(validProject)
    expect(result.success).toBe(true)
  })
})
