import { strict as assert } from 'node:assert';
import { describe, it } from 'node:test';
import type { Database } from '@pig/db';
import { createInteractivePigTools } from '../src/chat-tools';

describe('interactive lifecycle tool boundary', () => {
  it('exposes deterministic lifecycle context only for the account in focus', () => {
    const accountTools = createInteractivePigTools({} as Database, {
      type: 'account',
      id: '10000000-0000-4000-8000-000000000001',
    });
    const contractTools = createInteractivePigTools({} as Database, {
      type: 'contract',
      id: '20000000-0000-4000-8000-000000000001',
    });

    // Sliced to the focused tools: the lookup layer that follows them is on
    // every context and is covered in `lookup-tools.test.ts`.
    assert.deepEqual(accountTools.slice(0, 2).map((tool) => tool.name), ['pig_get_record', 'pig_get_account_lifecycle']);
    assert.equal(contractTools.some((tool) => tool.name === 'pig_get_account_lifecycle'), false);
  });
});
