/**
 * 권한 타입 정의 (PDF 54-55페이지 기준)
 */

// 권한 유형
export type PermissionType = 'view' | 'create' | 'update' | 'delete' | 'approve' | 'export' | 'manage';

// 메뉴별 권한 설정
export interface MenuPermission {
  menuId: string;
  menuName: string;
  parentMenuId?: string;
  permissions: {
    [key in PermissionType]?: boolean;
  };
}

// 권한 그룹
export interface Permission {
  id: number;
  name: string;
  status: 'active' | 'hidden'; // 공개/숨김
  menuPermissions: MenuPermission[];
  createdAt: string;
  updatedAt?: string;
}

export interface PermissionDialogProps {
  isOpen: boolean;
  onOpenChange: (open: boolean) => void;
  mode: 'add' | 'edit';
  permission?: Permission;
  onSubmit: (data: { name: string; status: 'active' | 'hidden' }) => void;
}

// 권한 라벨 매핑
export const PERMISSION_LABELS: Record<PermissionType, string> = {
  view: '조회',
  create: '생성',
  update: '수정',
  delete: '삭제',
  approve: '승인',
  export: '내보내기',
  manage: '관리',
};
