// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========

import { Accessor } from './base.ts'
import type { BoxTokenManager } from '../core/box/_client.ts'

export class BoxAccessor extends Accessor {
  readonly tokenManager: BoxTokenManager
  // Box folder id mounted as the workspace root; "0" is the account root.
  readonly rootFolderId: string
  // Opt in to grep/rg content-search push-down (off by default; Box's search
  // index lags recent writes).
  readonly contentSearch: boolean

  constructor(opts: {
    tokenManager: BoxTokenManager
    rootFolderId?: string
    contentSearch?: boolean
  }) {
    super()
    this.tokenManager = opts.tokenManager
    this.rootFolderId = opts.rootFolderId ?? '0'
    this.contentSearch = opts.contentSearch === true
  }
}
