001package com.box.sdkgen.schemas.aidialoguehistory;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.internal.utils.DateTimeUtils;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
009import com.fasterxml.jackson.databind.annotation.JsonSerialize;
010import java.time.OffsetDateTime;
011import java.util.Objects;
012
013/** A context object that can hold prior prompts and answers. */
014@JsonFilter("nullablePropertyFilter")
015public class AiDialogueHistory extends SerializableObject {
016
017  /** The prompt previously provided by the client and answered by the LLM. */
018  protected String prompt;
019
020  /** The answer previously provided by the LLM. */
021  protected String answer;
022
023  /** The ISO date formatted timestamp of when the previous answer to the prompt was created. */
024  @JsonProperty("created_at")
025  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
026  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
027  protected OffsetDateTime createdAt;
028
029  public AiDialogueHistory() {
030    super();
031  }
032
033  protected AiDialogueHistory(Builder builder) {
034    super();
035    this.prompt = builder.prompt;
036    this.answer = builder.answer;
037    this.createdAt = builder.createdAt;
038    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
039  }
040
041  public String getPrompt() {
042    return prompt;
043  }
044
045  public String getAnswer() {
046    return answer;
047  }
048
049  public OffsetDateTime getCreatedAt() {
050    return createdAt;
051  }
052
053  @Override
054  public boolean equals(Object o) {
055    if (this == o) {
056      return true;
057    }
058    if (o == null || getClass() != o.getClass()) {
059      return false;
060    }
061    AiDialogueHistory casted = (AiDialogueHistory) o;
062    return Objects.equals(prompt, casted.prompt)
063        && Objects.equals(answer, casted.answer)
064        && Objects.equals(createdAt, casted.createdAt);
065  }
066
067  @Override
068  public int hashCode() {
069    return Objects.hash(prompt, answer, createdAt);
070  }
071
072  @Override
073  public String toString() {
074    return "AiDialogueHistory{"
075        + "prompt='"
076        + prompt
077        + '\''
078        + ", "
079        + "answer='"
080        + answer
081        + '\''
082        + ", "
083        + "createdAt='"
084        + createdAt
085        + '\''
086        + "}";
087  }
088
089  public static class Builder extends NullableFieldTracker {
090
091    protected String prompt;
092
093    protected String answer;
094
095    protected OffsetDateTime createdAt;
096
097    public Builder prompt(String prompt) {
098      this.prompt = prompt;
099      return this;
100    }
101
102    public Builder answer(String answer) {
103      this.answer = answer;
104      return this;
105    }
106
107    public Builder createdAt(OffsetDateTime createdAt) {
108      this.createdAt = createdAt;
109      return this;
110    }
111
112    public AiDialogueHistory build() {
113      return new AiDialogueHistory(this);
114    }
115  }
116}