import * as DateTime from "effect/DateTime"
import { Schema } from "effect"
import { Base, SessionEventID, type BaseInput } from "./session-event-base"

export namespace Text {
  export class Started extends Schema.Class<Started>("Session.Event.Text.Started")({
    ...Base,
    type: Schema.Literal("text.started"),
  }) {
    static create(input: BaseInput = {}) {
      return new Started({ id: input.id ?? SessionEventID.create(), type: "text.started", timestamp: input.timestamp ?? DateTime.makeUnsafe(Date.now()), metadata: input.metadata })
    }
  }

  export class Delta extends Schema.Class<Delta>("Session.Event.Text.Delta")({
    ...Base,
    type: Schema.Literal("text.delta"),
    delta: Schema.String,
  }) {
    static create(input: BaseInput & { delta: string }) {
      return new Delta({ id: input.id ?? SessionEventID.create(), type: "text.delta", timestamp: input.timestamp ?? DateTime.makeUnsafe(Date.now()), metadata: input.metadata, delta: input.delta })
    }
  }

  export class Ended extends Schema.Class<Ended>("Session.Event.Text.Ended")({
    ...Base,
    type: Schema.Literal("text.ended"),
    text: Schema.String,
  }) {
    static create(input: BaseInput & { text: string }) {
      return new Ended({ id: input.id ?? SessionEventID.create(), type: "text.ended", timestamp: input.timestamp ?? DateTime.makeUnsafe(Date.now()), metadata: input.metadata, text: input.text })
    }
  }
}

export namespace Reasoning {
  export class Started extends Schema.Class<Started>("Session.Event.Reasoning.Started")({
    ...Base,
    type: Schema.Literal("reasoning.started"),
  }) {
    static create(input: BaseInput = {}) {
      return new Started({ id: input.id ?? SessionEventID.create(), type: "reasoning.started", timestamp: input.timestamp ?? DateTime.makeUnsafe(Date.now()), metadata: input.metadata })
    }
  }

  export class Delta extends Schema.Class<Delta>("Session.Event.Reasoning.Delta")({
    ...Base,
    type: Schema.Literal("reasoning.delta"),
    delta: Schema.String,
  }) {
    static create(input: BaseInput & { delta: string }) {
      return new Delta({ id: input.id ?? SessionEventID.create(), type: "reasoning.delta", timestamp: input.timestamp ?? DateTime.makeUnsafe(Date.now()), metadata: input.metadata, delta: input.delta })
    }
  }

  export class Ended extends Schema.Class<Ended>("Session.Event.Reasoning.Ended")({
    ...Base,
    type: Schema.Literal("reasoning.ended"),
    text: Schema.String,
  }) {
    static create(input: BaseInput & { text: string }) {
      return new Ended({ id: input.id ?? SessionEventID.create(), type: "reasoning.ended", timestamp: input.timestamp ?? DateTime.makeUnsafe(Date.now()), metadata: input.metadata, text: input.text })
    }
  }
}
