// 역할 옵션 const Map roleOptions = { 'admin': '관리자', 'clubadmin': '클럽 관리자', 'user': '일반 사용자', }; // ------------------------------- // Strong enums for client usage // ------------------------------- /// 참가자 상태 (서버 enum과 1:1 매칭) enum ParticipantStatus { pending, confirmed, canceled, attended } extension ParticipantStatusX on ParticipantStatus { String get apiValue { switch (this) { case ParticipantStatus.pending: return 'pending'; case ParticipantStatus.confirmed: return 'confirmed'; case ParticipantStatus.canceled: return 'canceled'; case ParticipantStatus.attended: return 'attended'; } } String get labelKo { switch (this) { case ParticipantStatus.pending: return '대기'; case ParticipantStatus.confirmed: return '확인됨'; case ParticipantStatus.canceled: return '취소됨'; case ParticipantStatus.attended: return '참석'; } } static ParticipantStatus? from(String? value) { switch ((value ?? '').toLowerCase()) { case 'pending': return ParticipantStatus.pending; case 'confirmed': return ParticipantStatus.confirmed; case 'canceled': return ParticipantStatus.canceled; case 'attended': return ParticipantStatus.attended; default: return null; } } } /// 결제 상태 (서버 enum과 1:1 매칭) enum PaymentStatus { unpaid, paid } extension PaymentStatusX on PaymentStatus { String get apiValue { switch (this) { case PaymentStatus.unpaid: return 'unpaid'; case PaymentStatus.paid: return 'paid'; } } String get labelKo { switch (this) { case PaymentStatus.unpaid: return '미납'; case PaymentStatus.paid: return '납부'; } } static PaymentStatus? from(String? value) { switch ((value ?? '').toLowerCase()) { case 'unpaid': return PaymentStatus.unpaid; case 'paid': return PaymentStatus.paid; default: return null; } } } // Backward-compatible helpers for non-enum callsites String toKoreanParticipantStatus(String? value) => (ParticipantStatusX.from(value) ?? ParticipantStatus.pending).labelKo; String toKoreanPaymentStatus(String? value) => (PaymentStatusX.from(value) ?? PaymentStatus.unpaid).labelKo; // 성별 옵션 const Map genderOptions = { 'male': '남성', 'female': '여성', }; // 회원 유형 옵션 const Map memberTypeOptions = { 'regular': '정회원', 'associate': '준회원', 'guest': '게스트', 'manager': '운영진', 'owner': '모임장', }; // 상태 옵션 const Map statusOptions = { 'active': '활성', 'inactive': '비활성', 'suspended': '정지', 'deleted': '삭제', }; // 참가자 상태 옵션 const Map participantStatusOptions = { 'pending': '참가예정', 'confirmed': '참가확정', 'canceled': '취소', }; // 이벤트 상태 옵션 const Map eventStatusOptions = { 'ready': '준비', 'active': '활성', 'completed': '완료', 'canceled': '취소', 'deleted': '삭제', }; // 이벤트 유형 옵션 const Map eventTypeOptions = { 'regular': '정기전', 'exchange': '교류전', 'tournament': '대회', 'lightning': '번개', 'friendly': '친선전', 'event': '이벤트', 'other': '기타', }; // 결제 상태 옵션 const Map paymentStatusOptions = { 'unpaid': '미납', 'paid': '납부완료', }; // 평균 산정 기준 옵션 const Map averageCalculationPeriodOptions = { 'total': '전체', '1year': '최근 1년', '6month': '최근 6개월', '3month': '최근 3개월', 'firsthalf': '상반기', 'secondhalf': '하반기', 'quarterly': '분기별', }; // 회원 유형 레이블 가져오기 String getMemberTypeLabel(String? memberType) { if (memberType == null) return '일반 회원'; return memberTypeOptions[memberType] ?? memberType; } // 역할 레이블 가져오기 String getRoleLabel(String? role) { if (role == null) return '일반 사용자'; return roleOptions[role] ?? role; } // 성별 레이블 가져오기 String getGenderLabel(String? gender) { if (gender == null) return '정보 없음'; return genderOptions[gender] ?? gender; } // 상태 레이블 가져오기 String getStatusLabel(String? status) { if (status == null) return '정보 없음'; return statusOptions[status] ?? status; } // 이벤트 상태 레이블 가져오기 String getEventStatusLabel(String? status) { if (status == null) return '정보 없음'; return eventStatusOptions[status] ?? status; } // 이벤트 유형 레이블 가져오기 String getEventTypeLabel(String? type) { if (type == null) return '기타'; return eventTypeOptions[type] ?? type; }