import { IP } from "../../interface/ip";
import { prisma } from "../../utils/prisma";

export class IpService {

    static async createIP(ip: IP) {
        const response = await prisma.ip.create({
            data: ip
        })
        return response
    }


    static async getIP() {
        const response = await prisma.ip.findMany()
        return response
    }


    static async getIpByIPAddress(ipAddress: string) {
        const response = await prisma.ip.findUnique({
            where: {
                ip_address: ipAddress
            }
        })
        return response
    }

    static async getIpByID(id: string) {
        const response = await prisma.ip.findUnique({
            where: {
                id
            }
        })
        return response
    }

    static async updateIP(ip: IP, id: string) {

        const response = await prisma.ip.update({
            data: ip,
            where: {
                id
            }
        })
        return response
    }



    static async deleteIP(id: string) {
        const response = await prisma.ip.delete({
            where: {
                id
            }
        })
        return response
    }



}