// To parse this JSON data, do
//
//     final registrationResponse = registrationResponseFromJson(jsonString);

import 'dart:convert';

import 'package:grostore/models/common/user_info.dart';

RegistrationResponse registrationResponseFromJson(String str) =>RegistrationResponse.fromJson(json.decode(str));

RegistrationResponses registrationResFromJson(String str) =>RegistrationResponses.fromJson(json.decode(str));

RegistrationResp registrationRespFromJson(String str) =>RegistrationResp.fromJson(json.decode(str));

RegistrationResp registrationRespDefault() =>RegistrationResp.fromJson(json.decode('''{
    "result": false,
    "message": "",
    "code":1}'''));

RegistrationResponse registrationResponseDefault() =>RegistrationResponse.fromJson(json.decode('''{
    "result": false,
    "message": "",
    "access_token": "",
    "token_type": ""
}'''));

RegistrationResponses registrationResponsesDefault() => RegistrationResponses.fromJson(json.decode('''{
    "result": false,
    "message": "",
    "access_token": "",
    "token_type": ""
}'''));

String registrationResponseToJson(RegistrationResponse data) =>json.encode(data.toJson());


class RegistrationResponse {
  bool result;
  String message;
  String accessToken;
  String tokenType;
  UserInfo user;

  RegistrationResponse(
      {required this.result,
      required this.message,
      required this.accessToken,
      required this.tokenType,
      required this.user});

  factory RegistrationResponse.fromJson(Map<String, dynamic> json) =>
      RegistrationResponse(
        result: json["result"],
        message: json["message"],
        accessToken: json["access_token"],
        tokenType: json["token_type"],
        user: UserInfo.fromJson(json["user"]),
      );

  Map<String, dynamic> toJson() => {
        "result": result,
        "message": message,
        "access_token": accessToken,
        "token_type": tokenType,
        "user": user.toJson(),
      };
}

class RegistrationResponses {
  bool result;
  var message;
  String accessToken;
  String tokenType;

  RegistrationResponses({
    required this.result,
    required this.message,
    required this.accessToken,
    required this.tokenType,
  });

  factory RegistrationResponses.fromJson(Map<String, dynamic> json) =>
      RegistrationResponses(
        result: json["result"],
        message: json["message"],
        accessToken: json["access_token"],
        tokenType: json["token_type"],
      );

  Map<String, dynamic> toJson() => {
        "result": result,
        "message": message,
        "access_token": accessToken,
        "token_type": tokenType,
      };
}

class RegistrationResp {
  bool result;
  String message;
  int code;

  RegistrationResp({required this.result, required this.message, required this.code});

  factory RegistrationResp.fromJson(Map<String, dynamic> json) =>
      RegistrationResp(
        result: json["result"],
        message: json["message"],
        code: json["code"],
      );

  Map<String, dynamic> toJson() => {
        "result": result,
        "message": message,
        "code": code,
      };
}
