package dao

import (
	"context"

	"go.signoz.io/signoz/pkg/query-service/model"
)

type ModelDao interface {
	Queries
	Mutations
}

type Queries interface {
	GetInviteFromEmail(ctx context.Context, email string) (*model.InvitationObject, *model.ApiError)
	GetInviteFromToken(ctx context.Context, token string) (*model.InvitationObject, *model.ApiError)
	GetInvites(ctx context.Context) ([]model.InvitationObject, *model.ApiError)

	GetUser(ctx context.Context, id string) (*model.UserPayload, *model.ApiError)
	GetUserByEmail(ctx context.Context, email string) (*model.UserPayload, *model.ApiError)
	GetUsers(ctx context.Context) ([]model.UserPayload, *model.ApiError)

	GetGroup(ctx context.Context, id string) (*model.Group, *model.ApiError)
	GetGroupByName(ctx context.Context, name string) (*model.Group, *model.ApiError)
	GetGroups(ctx context.Context) ([]model.Group, *model.ApiError)

	GetOrgs(ctx context.Context) ([]model.Organization, *model.ApiError)
	GetOrgByName(ctx context.Context, name string) (*model.Organization, *model.ApiError)
	GetOrg(ctx context.Context, id string) (*model.Organization, *model.ApiError)

	GetResetPasswordEntry(ctx context.Context, token string) (*model.ResetPasswordEntry, *model.ApiError)
	GetUsersByOrg(ctx context.Context, orgId string) ([]model.UserPayload, *model.ApiError)
	GetUsersByGroup(ctx context.Context, groupId string) ([]model.UserPayload, *model.ApiError)
}

type Mutations interface {
	CreateInviteEntry(ctx context.Context, req *model.InvitationObject) *model.ApiError
	DeleteInvitation(ctx context.Context, email string) *model.ApiError

	CreateUser(ctx context.Context, user *model.User) (*model.User, *model.ApiError)
	EditUser(ctx context.Context, update *model.User) (*model.User, *model.ApiError)
	DeleteUser(ctx context.Context, id string) *model.ApiError

	CreateGroup(ctx context.Context, group *model.Group) (*model.Group, *model.ApiError)
	DeleteGroup(ctx context.Context, id string) *model.ApiError

	CreateOrg(ctx context.Context, org *model.Organization) (*model.Organization, *model.ApiError)
	EditOrg(ctx context.Context, org *model.Organization) *model.ApiError
	DeleteOrg(ctx context.Context, id string) *model.ApiError

	CreateResetPasswordEntry(ctx context.Context, req *model.ResetPasswordEntry) *model.ApiError
	DeleteResetPasswordEntry(ctx context.Context, token string) *model.ApiError

	UpdateUserPassword(ctx context.Context, hash, userId string) *model.ApiError
	UpdateUserGroup(ctx context.Context, userId, groupId string) *model.ApiError
}
