import DiscountsEmail from "../../Models/DiscountsEmail/DiscountsEmail";
import { connect } from "mongoose";
import {
    CreateDiscountEmailParams,
    DeleteDiscountEmailParams,
    IDiscountEmail,
    PaginateDiscountsEmailParams,
    PaginateDiscountsEmailViewResults,
} from "../../Models/DiscountsEmail/DiscountsEmail.Interface";

export class DiscountsEmailService {
    public async createDiscountEmail(data: CreateDiscountEmailParams): Promise<IDiscountEmail> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        return DiscountsEmail.createDiscountEmail(data);
    }

    public async deleteDiscountEmail(data: DeleteDiscountEmailParams): Promise<void> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        return DiscountsEmail.deleteDiscountEmail(data);
    }

    public async paginate(data: PaginateDiscountsEmailParams): Promise<PaginateDiscountsEmailViewResults> {
        await connect(`${process.env.DATABASE_CONNECTION}`);
        return DiscountsEmail.paginate(data);
    }
}
