import {Session} from '@auth/core/types'
import {UserRole} from '@prisma/client'
import 'server-only'

//import SUPERVISOR from '@/lib/permission/roles/supervisor'

export interface SessionUser {
	id: string
	name: string
	email: string
	image: string | null
	isOauth: boolean
	provider: string | null
	role: UserRole
	profileId: number | null
	username: string | null
}

export interface SingedInSession extends Session {
	user: SessionUser
}

export enum Access {
	Admin = 'accessAdmin',
	Cabinet = 'accessCabinet'
}

export enum Update {
	Category = 'editCategory',
	Product = 'editProduct'
}

export enum Delete {
	Category = 'deleteCategory',
	Product = 'deleteProduct'
}

export type Permission = Access | Delete | Update

export type AllRolesPermissions = {
	SUPERVISOR: Permission[]
	CUSTOMER: Permission[]
}

export const PERMISSIONS: AllRolesPermissions = {
	SUPERVISOR: [
		...Object.values(Access),
		...Object.values(Update),
		...Object.values(Delete)
	],
	CUSTOMER: [Access.Cabinet]
} as const
