/** License window API (only the license window may call these commands). */
import { call } from "../transport";

export interface LicenseDocument {
  text: string;
  guidance: Record<string, string>;
  license: string;
  licenseVersion: string;
  sha256: string;
  appVersion: string;
  buildId: string;
  guidanceSha256: string;
  language: string;
}

export const license = Object.freeze({
  read: () => call<LicenseDocument>("license_read", "license:read"),
  showLicense: (payload: { guidanceSha256: string }) => call<{ ok: true }>("license_show", "license:show", payload),
  accept: (payload: { accepted: true; sha256: string; guidanceSha256: string }) => call<{ ok: true }>("license_accept", "license:accept", payload),
  decline: () => call<{ ok: true }>("license_decline", "license:decline")
});
