/// 입고지 정보를 나타내는 모델 클래스 (백엔드 API 호환)
class WarehouseLocation {
  /// 입고지 고유 번호
  final int id;

  /// 입고지명
  final String name;

  /// 주소 (단일 문자열)
  final String? address;
  
  /// 우편번호 (zipcodes_zipcode 필드)
  final String? zipcode;

  /// 담당자명
  final String? managerName;

  /// 담당자 연락처
  final String? managerPhone;

  /// 수용량
  final int? capacity;

  /// 비고
  final String? remark;

  /// 활성 상태
  final bool isActive;

  /// 생성일
  final DateTime createdAt;

  WarehouseLocation({
    required this.id,
    required this.name,
    this.address,
    this.zipcode,
    this.managerName,
    this.managerPhone,
    this.capacity,
    this.remark,
    this.isActive = true,
    DateTime? createdAt,
  }) : createdAt = createdAt ?? DateTime.now();

  /// 복사본 생성 (불변성 유지)
  WarehouseLocation copyWith({
    int? id,
    String? name,
    String? address,
    String? zipcode,
    String? managerName,
    String? managerPhone,
    int? capacity,
    String? remark,
    bool? isActive,
    DateTime? createdAt,
  }) {
    return WarehouseLocation(
      id: id ?? this.id,
      name: name ?? this.name,
      address: address ?? this.address,
      zipcode: zipcode ?? this.zipcode,
      managerName: managerName ?? this.managerName,
      managerPhone: managerPhone ?? this.managerPhone,
      capacity: capacity ?? this.capacity,
      remark: remark ?? this.remark,
      isActive: isActive ?? this.isActive,
      createdAt: createdAt ?? this.createdAt,
    );
  }
}
