import {rest} from "msw";
import {GET_ROLE_LIST, GET_ROLES} from "@/core/data/apiRoutes";

export const rolesHandler = [
    rest.get(GET_ROLES, (req, res, ctx) => {
        return res(
            ctx.json(
                {
                    data: [
                        {
                            created_at: "2023-10-01T07:20:07.000000Z",
                            guard_name: "api",
                            id: 1,
                            name: "admin",
                            name_fa: "ادمین",
                            permissions: [
                                {
                                    id: 1,
                                    name: "manage_users",
                                },
                                {
                                    id: 2,
                                    name: "manage_roles",
                                },
                            ],
                            updated_at: "2023-10-10T07:38:12.000000Z"
                        },
                        {
                            created_at: "2023-10-01T07:20:07.000000Z",
                            guard_name: "api",
                            id: 2,
                            name: "manager",
                            name_fa: "مدیر",
                            permissions: [
                                {
                                    id: 1,
                                    name: "manage_users",
                                },
                                {
                                    id: 2,
                                    name: "manage_roles",
                                },
                            ],
                            updated_at: "2023-10-10T07:38:12.000000Z"
                        }
                    ],
                    meta: {
                        totalRowCount: 2
                    }
                }
            ),
        );
    }),
    rest.get(GET_ROLE_LIST, (req, res, ctx) => {
        return res(ctx.json({
            data: [
                {
                    id: 1,
                    name: "admin",
                    name_fa: "ادمین"
                },
                {
                    id: 2,
                    name: "manager",
                    name_fa: "مدیر"
                }
            ]
        }))
    }),
]