// 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"
	"github.com/openimsdk/tools/db/pagination"
)

// MeetingCheckIn defines the operations for managing meeting check-ins in MongoDB.
type MeetingCheckIn interface {
	// Create creates a new meeting check-in record.
	Create(ctx context.Context, checkIn *model.MeetingCheckIn) error
	// Take retrieves a check-in by check-in ID. Returns an error if not found.
	Take(ctx context.Context, checkInID string) (*model.MeetingCheckIn, error)
	// FindByMeetingID finds all check-ins for a meeting with pagination.
	FindByMeetingID(ctx context.Context, meetingID string, pagination pagination.Pagination) (total int64, checkIns []*model.MeetingCheckIn, err error)
	// FindByUserAndMeetingID finds if a user has checked in for a specific meeting.
	FindByUserAndMeetingID(ctx context.Context, userID, meetingID string) (*model.MeetingCheckIn, error)
	// CountByMeetingID counts the number of check-ins for a meeting.
	CountByMeetingID(ctx context.Context, meetingID string) (int64, error)
	// FindByUser finds all check-ins by a user with pagination.
	FindByUser(ctx context.Context, userID string, pagination pagination.Pagination) (total int64, checkIns []*model.MeetingCheckIn, err error)
	// Delete deletes a check-in by check-in ID.
	Delete(ctx context.Context, checkInID string) error
}

