- 전체 371개 파일 중 82개 미사용 파일 식별 - Phase 1: 33개 파일 삭제 예정 (100% 안전) - Phase 2: 30개 파일 삭제 검토 예정 - Phase 3: 19개 파일 수동 검토 예정 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
82 lines
2.2 KiB
Dart
82 lines
2.2 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'zipcode_dto.freezed.dart';
|
|
part 'zipcode_dto.g.dart';
|
|
|
|
@freezed
|
|
class ZipcodeDto with _$ZipcodeDto {
|
|
const ZipcodeDto._(); // Private constructor for getters
|
|
|
|
const factory ZipcodeDto({
|
|
required String zipcode,
|
|
required String sido,
|
|
required String gu,
|
|
@JsonKey(name: 'etc') required String etc,
|
|
@JsonKey(name: 'is_deleted')
|
|
@Default(false) bool isDeleted,
|
|
@JsonKey(name: 'created_at')
|
|
DateTime? createdAt,
|
|
@JsonKey(name: 'updated_at')
|
|
DateTime? updatedAt,
|
|
}) = _ZipcodeDto;
|
|
|
|
// isActive 계산 속성 (is_deleted의 반대)
|
|
bool get isActive => !isDeleted;
|
|
|
|
// 전체 주소 문자열 생성
|
|
String get fullAddress => '$sido $gu $etc';
|
|
|
|
// 축약된 주소 (시도 + 구)
|
|
String get shortAddress => '$sido $gu';
|
|
|
|
// 검색용 문자열 (모든 필드 결합)
|
|
String get searchableText => '$zipcode $sido $gu $etc';
|
|
|
|
factory ZipcodeDto.fromJson(Map<String, dynamic> json) => _$ZipcodeDtoFromJson(json);
|
|
}
|
|
|
|
// API 응답 래퍼
|
|
@freezed
|
|
class ZipcodeListResponse with _$ZipcodeListResponse {
|
|
const factory ZipcodeListResponse({
|
|
@JsonKey(name: 'data')
|
|
required List<ZipcodeDto> items,
|
|
@JsonKey(name: 'total')
|
|
@Default(0) int totalCount,
|
|
@JsonKey(name: 'page')
|
|
@Default(1) int currentPage,
|
|
@JsonKey(name: 'total_pages')
|
|
@Default(1) int totalPages,
|
|
@JsonKey(name: 'page_size')
|
|
int? pageSize,
|
|
}) = _ZipcodeListResponse;
|
|
|
|
factory ZipcodeListResponse.fromJson(Map<String, dynamic> json) =>
|
|
_$ZipcodeListResponseFromJson(json);
|
|
}
|
|
|
|
// Hierarchy API 응답 래퍼
|
|
@freezed
|
|
class HierarchyMeta with _$HierarchyMeta {
|
|
const factory HierarchyMeta({
|
|
required int total,
|
|
String? sido,
|
|
String? gu,
|
|
}) = _HierarchyMeta;
|
|
|
|
factory HierarchyMeta.fromJson(Map<String, dynamic> json) =>
|
|
_$HierarchyMetaFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class HierarchyResponse with _$HierarchyResponse {
|
|
const factory HierarchyResponse({
|
|
@JsonKey(name: 'data') required List<String> data,
|
|
@JsonKey(name: 'meta') required HierarchyMeta meta,
|
|
}) = _HierarchyResponse;
|
|
|
|
factory HierarchyResponse.fromJson(Map<String, dynamic> json) =>
|
|
_$HierarchyResponseFromJson(json);
|
|
}
|
|
|