import type { DB } from "../generated/kysely-tailordb";
import type {
  InferSchema,
  Selectable,
  Insertable,
  Updateable,
} from "@tailor-platform/erp-kit/module";

export type Schema = InferSchema<DB>;

export type User<T extends { User: object }> = Selectable<T["User"]>;
export type UserCreate<T extends { User: object }> = Insertable<T["User"]>;
export type UserUpdate<T extends { User: object }> = Updateable<T["User"]>;

export type Permission<T extends { Permission: object }> = Selectable<T["Permission"]>;
export type PermissionCreate<T extends { Permission: object }> = Insertable<T["Permission"]>;
export type PermissionUpdate<T extends { Permission: object }> = Updateable<T["Permission"]>;

export type Role<T extends { Role: object }> = Selectable<T["Role"]>;
export type RoleCreate<T extends { Role: object }> = Insertable<T["Role"]>;
export type RoleUpdate<T extends { Role: object }> = Updateable<T["Role"]>;

export type UserRole<T extends { UserRole: object }> = Selectable<T["UserRole"]>;
export type UserRoleCreate<T extends { UserRole: object }> = Insertable<T["UserRole"]>;
export type UserRoleUpdate<T extends { UserRole: object }> = Updateable<T["UserRole"]>;

export type RolePermission<T extends { RolePermission: object }> = Selectable<T["RolePermission"]>;
export type RolePermissionCreate<T extends { RolePermission: object }> = Insertable<
  T["RolePermission"]
>;
export type RolePermissionUpdate<T extends { RolePermission: object }> = Updateable<
  T["RolePermission"]
>;

export type AuditEvent<T extends { AuditEvent: object }> = Selectable<T["AuditEvent"]>;
export type AuditEventCreate<T extends { AuditEvent: object }> = Insertable<T["AuditEvent"]>;
