import { createEmptyProject } from '../../../src/project/project.schema';
import type {
  AvProjectV1,
  MediaAssetReference,
} from '../../../src/project/project.types';

export const CREATED_AT = '2026-01-02T03:04:05.000Z';
export const UPDATED_AT = '2026-01-02T04:00:00.000Z';

export function mediaAsset(
  overrides: Partial<MediaAssetReference> = {}
): MediaAssetReference {
  return {
    id: 'asset-1',
    originalName: 'source.mp4',
    size: 1_024,
    lastModified: 1_700_000_000_000,
    mimeType: 'video/mp4',
    sourceStatus: 'attached',
    probe: {
      durationSeconds: 10,
      formatNames: ['mov', 'mp4'],
      tags: {},
      streams: [
        {
          index: 0,
          type: 'video',
          codecName: 'h264',
          disposition: { default: true },
          tags: {},
        },
      ],
      chapters: [],
      warnings: [],
    },
    ...overrides,
  };
}

export function populatedProject(): AvProjectV1 {
  const project = createEmptyProject({
    id: 'project-1',
    name: 'Demo project',
    timestamp: CREATED_AT,
  });
  return {
    ...project,
    assets: [mediaAsset()],
    timeline: [
      {
        id: 'clip-1',
        assetId: 'asset-1',
        sourceInSeconds: 1,
        sourceOutSeconds: 4.5,
        audio: { enabled: true, fadeInSeconds: 0.2 },
        video: { enabled: true },
      },
    ],
    ui: {
      selectedAssetId: 'asset-1',
      selectedClipId: 'clip-1',
      inspectorPanel: 'clip',
      timelineZoom: 1,
    },
  };
}
