// @/data/config.ts

export const BASE_NAV_ITEMS = [
  { name: '소개', href: '/about', icon: ['fas', 'info-circle'] },
  { name: '공유 오피스 예약', href: '/office', icon: ['fas', 'calendar-alt'] },
  {
    name: '워크케이션 프로그램',
    href: '/',
    icon: ['fas', 'umbrella-beach'],
  },
  { name: '쇼핑하기', href: '/shop', icon: ['fas', 'shopping-bag'] },
  { name: '문의하기', href: '/contact', icon: ['fas', 'envelope'] },
  {
    name: '와디즈 펀딩 참여자',
    href: '/wadiz',
    icon: ['fas', 'star'],
    color: 'red',
  },

  // ...maybe { name: '와디즈 참여자', href: '/landing/wadiz' }
  // …
  { name: 'CMS', href: '/cms', requiredRole: 6, icon: ['fas', 'cog'] },
];
export const SOCIAL_LINKS = {
  naver: 'https://naver.me/GDauV41H',
  instagram: 'https://www.instagram.com/bobu_0_0/#',
  kakao: 'https://pf.kakao.com/_abcdefg',
};

export const companyInfo = {
  name: '노마드보부', // Or the official name from registration
  registrationNumber: '830-86-02932',
  president: '서지민',
  address: '강원 정선군 정선읍 정선로 1324, 2층',
  phone: '0507-1353-1868',
  fax: '070-7966-2168',
  email: 'bobu1104@naver.com',
  copyYear: new Date().getFullYear(), // Automatically get current year
};
// Upload Settings
const MAX_FILE_SIZE_MB = 20;
const MAX_TOTAL_FILES = 10;

const ALLOWED_IMAGE_TYPES = [
  'image/jpeg',
  'image/png',
  'image/gif',
  'image/webp',
  'image/jpg',
];
const ALLOWED_VIDEO_TYPES = [
  'video/mp4',
  'video/avi',
  'video/mpeg',
  'video/quicktime',
  'video/x-ms-wmv',
];
export const ALLOWED_DOCUMENT_TYPES = [
  // Word Documents
  'application/msword', // .doc
  'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // .docx
  // Excel Sheets
  'application/vnd.ms-excel', // .xls
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx
  // PowerPoint Presentations
  'application/vnd.ms-powerpoint', // .ppt
  'application/vnd.openxmlformats-officedocument.presentationml.presentation', // .pptx
  // PDFs
  'application/pdf',
  // Hangul Word Processor (Korean)
  'application/x-hwp', // .hwp (standardized older type)
  'application/x-hwpx', // .hwpx (newer format)
];

const ALLOWED_FILE_TYPES = [
  ...ALLOWED_IMAGE_TYPES,
  ...ALLOWED_DOCUMENT_TYPES,
  ...ALLOWED_VIDEO_TYPES,
];

const MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024;

// User Role Settings
export const ROLE_THRESHOLD = {
  MASTER: 9,
  ADMIN: 7,
  MANAGER: 5,
  TEACHER: 3,
  USER: 1,
} as const;

// Utility Functions
const isImageFile = (file: File): boolean =>
  ALLOWED_IMAGE_TYPES.includes(file.type);
const isVideoFile = (file: File): boolean =>
  ALLOWED_VIDEO_TYPES.includes(file.type);
const isDocumentFile = (file: File): boolean =>
  ALLOWED_DOCUMENT_TYPES.includes(file.type);

const isValidFile = (file: File): boolean => {
  return (
    ALLOWED_FILE_TYPES.includes(file.type) && file.size <= MAX_FILE_SIZE_BYTES
  );
};

const getInvalidFileReasonKey = (file: File): string | null => {
  if (!ALLOWED_FILE_TYPES.includes(file.type)) return 'upload.invalid_type';
  if (file.size > MAX_FILE_SIZE_BYTES) return 'upload.exceeds_size';
  return null;
};

// Error Messages
const UploadErrorMessages: Record<string, string> = {
  'upload.invalid_type': '허용되지 않은 파일 형식입니다.',
  'upload.exceeds_size': `파일 크기는 ${MAX_FILE_SIZE_MB}MB 이하만 가능합니다.`,
};
//Course Categories
export const CourseCategories = [
  '동료지원가 양성과정',
  '정신건강 바로알기',
  '회복으로 가는 길',
  // '연주',
  // '실용음악',
  // '국악',
  // '융합교육',
  // '프로그램'
] as const;
export const ProgramCategories = [
  '자격증 과정',
  '일반 과정',
  '심화 과정',
] as const;
// Video Providers
export const VideoProviders = ['youtube', 'vimeo', 'unknown'] as const;

// Export
export const UploadSettings = {
  MAX_FILE_SIZE_MB,
  MAX_TOTAL_FILES,
  MAX_FILE_SIZE_BYTES,
  ALLOWED_FILE_TYPES,
  ALLOWED_IMAGE_TYPES,
  ALLOWED_VIDEO_TYPES,
  ALLOWED_DOCUMENT_TYPES,
  ALLOWED_EXTENSIONS: ALLOWED_FILE_TYPES.join(','),
  isImageFile,
  isVideoFile,
  isDocumentFile,
  isValidFile,
  getInvalidFileReasonKey,
  UploadErrorMessages,
};
export type CourseCategory = (typeof CourseCategories)[number];
export type ProgramCategory = (typeof ProgramCategories)[number];
export type VideoProvider = (typeof VideoProviders)[number];
