Gliner/Preprocessing/GlinerPreprocessing.cs
using System;
using System.Collections.Generic;

namespace GlinerPoc.Preprocessing;

/// <summary>One classification candidate: label plus optional description.</summary>
public sealed class GlinerCandidate
{
	public string Label { get; }
	public string Description { get; }

	public GlinerCandidate( string label, string description = null )
	{
		Label = label;
		Description = description;
	}
}

/// <summary>
/// Preprocessing-facing classification request (Phase 3.2). Pure managed data;
/// no scene/engine dependencies. Description presence follows the official
/// semantics: if any candidate has a description, descriptions mode is active
/// and provided descriptions are appended to the task prompt.
/// </summary>
public sealed class GlinerClassificationRequest
{
	public string Context { get; }
	public string Task { get; }
	public IReadOnlyList<GlinerCandidate> Candidates { get; }

	public GlinerClassificationRequest( string context, string task,
		IReadOnlyList<GlinerCandidate> candidates )
	{
		Context = context;
		Task = task;
		Candidates = candidates;
	}
}

/// <summary>
/// Native preprocessing output — everything Phase 4+ needs plus debug data.
/// </summary>
public sealed class GlinerEncodedRequest
{
	public int[] InputIds { get; }
	public byte[] AttentionMask { get; }
	public int[] ClassificationMarkerIndices { get; }
	public IReadOnlyList<string> CandidateOrder { get; }
	public int WordCount { get; }
	public int TokenCount => InputIds.Length;

	// Debug/reference data (retained only when the request was encoded with
	// diagnostics enabled).
	public string[] SchemaTokens { get; }
	public string[] ContextWords { get; }
	public string[] CombinedTokens { get; }
	public string[] Pieces { get; }

	public GlinerEncodedRequest( int[] inputIds, byte[] attentionMask,
		int[] classificationMarkerIndices, IReadOnlyList<string> candidateOrder,
		int wordCount, string[] schemaTokens, string[] contextWords,
		string[] combinedTokens, string[] pieces )
	{
		InputIds = inputIds;
		AttentionMask = attentionMask;
		ClassificationMarkerIndices = classificationMarkerIndices;
		CandidateOrder = candidateOrder;
		WordCount = wordCount;
		SchemaTokens = schemaTokens;
		ContextWords = contextWords;
		CombinedTokens = combinedTokens;
		Pieces = pieces;
	}
}