# NOTE: This file is auto generated by OpenAPI Generator 7.13.0 (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule FinFeedAPISECRESTAPI.Api.FullTextSearch do
  @moduledoc """
  API calls for all endpoints tagged `FullTextSearch`.
  """

  alias FinFeedAPISECRESTAPI.Connection
  import FinFeedAPISECRESTAPI.RequestBuilder

  @doc """
  Full-text search of SEC filing documents
  Search across SEC filing documents with advanced filtering and sorting capabilities.  ### Available Sort Fields  Field Name | Description -----------|------------- AccessionNumber | SEC filing accession number FormType | Type of the filing document FilingDate | Date when filing was submitted CompanyName | Name of the company CIK | Central Index Key DocumentFilename | Name of the filing document DocumentDescription | Description of the document  ### Search Options  Option | Description --------|------------- text_contains | Keywords that must appear in the document text_not_contain | Keywords that must not appear in the document  ### Date Format All dates must be provided in YYYY-MM-DD format  :::tip Use text_contains and text_not_contain with multiple keywords separated by commas for more precise searches :::  :::note The search is case-insensitive and supports partial word matches :::

  ### Parameters

  - `connection` (FinFeedAPISECRESTAPI.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:form_type` (String.t): Filter by form type (e.g., \"10-K\", \"8-K\"). Multiple values can be comma-separated
    - `:filling_date_start` (String.t): Filter by filling date start (inclusive), format YYYY-MM-DD
    - `:filling_date_end` (String.t): Filter by filling date end (inclusive), format YYYY-MM-DD
    - `:text_contains` (String.t): Keywords that the text must contain. Multiple values can be comma-separated
    - `:text_not_contain` (String.t): Keywords that the text must not contain. Multiple values can be comma-separated
    - `:page_size` (integer()): Number of results per page (default: 100)
    - `:page_number` (integer()): Page number to retrieve (default: 1)
    - `:sort_by` (String.t): Field to sort by (default: AccessionNumber)
    - `:sort_order` (String.t): Sort order (asc or desc). Defaults to asc

  ### Returns

  - `{:ok, [%DtoSecFilingResultDto{}, ...]}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_full_text_get(Tesla.Env.client, keyword()) :: {:ok, [FinFeedAPISECRESTAPI.Model.DtoSecFilingResultDto.t]} | {:ok, FinFeedAPISECRESTAPI.Model.MvcValidationProblemDetails.t} | {:ok, FinFeedAPISECRESTAPI.Model.MvcProblemDetails.t} | {:error, Tesla.Env.t}
  def v1_full_text_get(connection, opts \\ []) do
    optional_params = %{
      :form_type => :query,
      :filling_date_start => :query,
      :filling_date_end => :query,
      :text_contains => :query,
      :text_not_contain => :query,
      :page_size => :query,
      :page_number => :query,
      :sort_by => :query,
      :sort_order => :query
    }

    request =
      %{}
      |> method(:get)
      |> url("/v1/full-text")
      |> add_optional_params(optional_params, opts)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, FinFeedAPISECRESTAPI.Model.DtoSecFilingResultDto},
      {400, FinFeedAPISECRESTAPI.Model.MvcValidationProblemDetails},
      {500, FinFeedAPISECRESTAPI.Model.MvcProblemDetails}
    ])
  end
end
