/**
 * StrandController — encapsulates strand and conflict analysis operations.
 *
 * Extracted from strand.methods.js and conflict.methods.js. WarpRuntime
 * delegates directly to this controller via defineProperty loops.
 *
 * @module domain/services/controllers/StrandController
 */
import createStrandCoordinator from "../strand/createStrandCoordinator.js";
import { ConflictAnalyzerService } from "../strand/ConflictAnalyzerService.js";
export default class StrandController {
    _host;
    _strandService;
    constructor(host) {
        this._host = host;
        this._strandService = createStrandCoordinator(host);
    }
    // ── Strand lifecycle ────────────────────────────────────────────────────
    async createStrand(options) {
        return await this._strandService.create(options);
    }
    async braidStrand(strandId, options) {
        return await this._strandService.braid(strandId, options);
    }
    async getStrand(strandId) {
        return await this._strandService.get(strandId);
    }
    async listStrands() {
        return await this._strandService.list();
    }
    async dropStrand(strandId) {
        return await this._strandService.drop(strandId);
    }
    // ── Strand materialization & queries ─────────────────────────────────────
    async materializeStrand(strandId, options) {
        return await this._strandService.materialize(strandId, options);
    }
    async _materializeStrandLive(strandId, options) {
        return await this._strandService.materializeLiveState(strandId, options);
    }
    async _materializeStrandRead(strandId, options) {
        return await this._strandService.materializeReadState(strandId, options);
    }
    async getStrandPatches(strandId, options) {
        return await this._strandService.getPatchEntries(strandId, options);
    }
    async patchesForStrand(strandId, entityId, options) {
        return await this._strandService.patchesFor(strandId, entityId, options);
    }
    // ── Strand patching ─────────────────────────────────────────────────────
    async createStrandPatch(strandId) {
        return await this._strandService.createPatchBuilder(strandId);
    }
    async patchStrand(strandId, build) {
        return await this._strandService.patch(strandId, build);
    }
    // ── Speculative intents ─────────────────────────────────────────────────
    async queueStrandIntent(strandId, build) {
        return await this._strandService.queueIntent(strandId, build);
    }
    async listStrandIntents(strandId) {
        return await this._strandService.listIntents(strandId);
    }
    async tickStrand(strandId) {
        return await this._strandService.tick(strandId);
    }
    // ── Conflict analysis ───────────────────────────────────────────────────
    async analyzeConflicts(options) {
        const analyzer = new ConflictAnalyzerService({ graph: this._host });
        return await analyzer.analyze(options);
    }
}
