// Copyright © 2023 OpenIM. 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.

package database

import (
	"context"

	"git.imall.cloud/openim/open-im-server-deploy/pkg/common/storage/model"
)

// SystemConfig defines the operations for managing system configurations in MongoDB.
type SystemConfig interface {
	// Create creates a new system config record.
	Create(ctx context.Context, config *model.SystemConfig) error
	// Take retrieves a system config by key. Returns an error if not found.
	Take(ctx context.Context, key string) (*model.SystemConfig, error)
	// Update updates system config information.
	Update(ctx context.Context, key string, data map[string]any) error
	// Find finds system configs by keys.
	Find(ctx context.Context, keys []string) ([]*model.SystemConfig, error)
	// FindEnabled finds all enabled system configs.
	FindEnabled(ctx context.Context) ([]*model.SystemConfig, error)
	// FindByKey finds a system config by key (returns nil if not found, no error).
	FindByKey(ctx context.Context, key string) (*model.SystemConfig, error)
	// Delete deletes a system config by key.
	Delete(ctx context.Context, key string) error
}
