import 'package:json_annotation/json_annotation.dart';

part 'auth_model.g.dart';

@JsonSerializable()
class LoginResponse {
  @JsonKey(name: 'access_token')
  final String accessToken;

  @JsonKey(name: 'customer')
  final CustomerResponse customer;

  const LoginResponse({required this.accessToken, required this.customer});

  factory LoginResponse.fromJson(Map<String, dynamic> json) =>
      _$LoginResponseFromJson(json);

  Map<String, dynamic> toJson() => _$LoginResponseToJson(this);
}

@JsonSerializable()
class CustomerResponse {
  final String uuid;

  final String name;

  final String? email;

  @JsonKey(name: 'phone_number')
  final String phoneNumber;

  const CustomerResponse({
    required this.uuid,
    required this.name,
    this.email,
    required this.phoneNumber,
  });

  factory CustomerResponse.fromJson(Map<String, dynamic> json) =>
      _$CustomerResponseFromJson(json);

  Map<String, dynamic> toJson() => _$CustomerResponseToJson(this);
}

@JsonSerializable()
class RegisterRequest {
  final String name;

  final String? email;

  @JsonKey(name: 'phone_number')
  final String phoneNumber;

  final String password;

  const RegisterRequest({
    required this.name,
    this.email,
    required this.phoneNumber,
    required this.password,
  });

  factory RegisterRequest.fromJson(Map<String, dynamic> json) =>
      _$RegisterRequestFromJson(json);

  Map<String, dynamic> toJson() => _$RegisterRequestToJson(this);
}
