# -*- mode: python -*-

Import("env")

env = env.Clone()

env.SConscript(
    dirs=[
        'bucket_catalog',
    ],
    exports=[
        'env',
    ],
)

env.Library(
    target='timeseries_options',
    source=[
        'timeseries.idl',
        'timeseries_global_options.cpp',
        'timeseries_options.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/query/query_shape/query_shape',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        '$BUILD_DIR/mongo/util/processinfo',
    ],
)

env.Library(
    target='bucket_compression',
    source=[
        'bucket_compression.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/bson/util/bson_column',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        '$BUILD_DIR/mongo/util/fail_point',
    ],
)

env.Library(
    target='timeseries_stats',
    source=[
        'timeseries_stats.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/pipeline/pipeline',
    ],
)

env.Library(
    target='catalog_helper',
    source=[
        'catalog_helper.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/collection_catalog',
        '$BUILD_DIR/mongo/db/server_base',
        'timeseries_options',
    ],
)

env.Library(
    target='timeseries_conversion_util',
    source=[
        'timeseries_commands_conversion_helper.cpp',
        'timeseries_dotted_path_support.cpp',
        'timeseries_index_schema_conversion_functions.cpp',
        'timeseries_update_delete_util.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/bson/mutable/mutable_bson',
        '$BUILD_DIR/mongo/bson/util/bson_column',
        '$BUILD_DIR/mongo/db/catalog/index_catalog',
        '$BUILD_DIR/mongo/db/exec/bucket_unpacker',
        '$BUILD_DIR/mongo/db/index_commands_idl',
        '$BUILD_DIR/mongo/db/ops/write_ops_parsers',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        'bucket_compression',
        'timeseries_options',
    ],
)

env.Library(
    target='timeseries_collmod',
    source=[
        'timeseries_collmod.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/bson/mutable/mutable_bson',
        '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
        '$BUILD_DIR/mongo/db/coll_mod_command_idl',
        '$BUILD_DIR/mongo/db/exec/bucket_unpacker',
        '$BUILD_DIR/mongo/db/server_base',
        'catalog_helper',
        'timeseries_conversion_util',
        'timeseries_options',
    ],
)

env.Library(
    target='timeseries_write_util',
    source=[
        'timeseries_write_util.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/catalog/collection_crud',
        '$BUILD_DIR/mongo/db/catalog/collection_query_info',
        '$BUILD_DIR/mongo/db/catalog/document_validation',
        '$BUILD_DIR/mongo/db/ops/write_ops_exec_util',
        '$BUILD_DIR/mongo/db/query/query_stats/query_stats',
        '$BUILD_DIR/mongo/db/record_id_helpers',
        '$BUILD_DIR/mongo/db/repl/tenant_migration_decoration',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/db/timeseries/bucket_catalog/bucket_catalog',
        '$BUILD_DIR/mongo/db/update/update_common',
        'timeseries_options',
    ],
)

env.Library(
    target='timeseries_extended_range',
    source=[
        'timeseries_extended_range.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/catalog/index_catalog',
        'timeseries_options',
    ],
)

env.Library(
    target='timeseries_metadata',
    source=[
        'metadata.cpp',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/base',
    ],
)

env.CppUnitTest(
    target='db_timeseries_test',
    source=[
        'bucket_compression_test.cpp',
        'timeseries_dotted_path_support_test.cpp',
        'timeseries_extended_range_test.cpp',
        'timeseries_index_schema_conversion_functions_test.cpp',
        'timeseries_options_test.cpp',
        'timeseries_update_delete_util_test.cpp',
        'timeseries_write_util_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/catalog/catalog_test_fixture',
        '$BUILD_DIR/mongo/db/catalog/collection_crud',
        '$BUILD_DIR/mongo/db/record_id_helpers',
        '$BUILD_DIR/mongo/db/shard_role',
        '$BUILD_DIR/mongo/db/timeseries/bucket_catalog/bucket_catalog',
        'bucket_compression',
        'timeseries_conversion_util',
        'timeseries_extended_range',
        'timeseries_options',
        'timeseries_write_util',
    ],
)
