namespace EngineSdkConverter.Unity.SDK
{
    /// <summary>
    /// 设置FIrebase崩溃自定义键值对
    /// </summary>
    public class FirebaseCrashCustomKeyBuilder
    {
        public class FirebaseCrashCustomKeyType : KeyValueType
        {
        }

        private FirebaseCrashCustomKeyType _firebaseCrashCustomKey;

        public FirebaseCrashCustomKeyBuilder()
        {
            _firebaseCrashCustomKey = new FirebaseCrashCustomKeyType();
        }

        public FirebaseCrashCustomKeyBuilder SetKey(string key)
        {
            _firebaseCrashCustomKey.key = key;
            return this;
        }

        public FirebaseCrashCustomKeyBuilder SetValue(string value)
        {
            _firebaseCrashCustomKey.value = value;
            return this;
        }

        public FirebaseCrashCustomKeyType Build()
        {
            return _firebaseCrashCustomKey;
        }
    }

    /// <summary>
    /// 上报FIrebase崩溃自定义消息
    /// </summary>
    public class FirebaseCrashLogBuilder
    {
        public class FirebaseCrashLogType : MessageType
        {
        }

        private FirebaseCrashLogType _firebaseCrashLog;

        public FirebaseCrashLogBuilder()
        {
            _firebaseCrashLog = new FirebaseCrashLogType();
        }

        public FirebaseCrashLogBuilder SetMessage(string message)
        {
            _firebaseCrashLog.message = message;
            return this;
        }

        public FirebaseCrashLogType Build()
        {
            return _firebaseCrashLog;
        }
    }

    /// <summary>
    /// 设置FIrebase崩溃用户标识符
    /// </summary>
    public class FirebaseCrashUserIdentifierBuilder
    {
        public class FirebaseCrashUserIdentifierType : IdentifierType
        {
        }

        private FirebaseCrashUserIdentifierType _firebaseCrashUserIdentifier;

        public FirebaseCrashUserIdentifierBuilder()
        {
            _firebaseCrashUserIdentifier = new FirebaseCrashUserIdentifierType();
        }

        public FirebaseCrashUserIdentifierBuilder SetIdentifier(string identifier)
        {
            _firebaseCrashUserIdentifier.identifier = identifier;
            return this;
        }

        public FirebaseCrashUserIdentifierType Build()  
        {
            return _firebaseCrashUserIdentifier;    
        }
    }

    /// <summary>
    /// 上报FIrebase崩溃异常
    /// </summary>
    public class FirebaseCrashExceptionTypeBuilder
    {
        public class FirebaseCrashExceptionType
        {
            public string domain;
            public int code;
            public string name;
            public string message;
            public string stackTrace;
        }

        private FirebaseCrashExceptionType _firebaseCrashException;

        public FirebaseCrashExceptionTypeBuilder()
        {
            _firebaseCrashException = new FirebaseCrashExceptionType();
        }
        public FirebaseCrashExceptionTypeBuilder SetDomain(string domain)
        {
            _firebaseCrashException.domain = domain;
            return this;
        }

        public FirebaseCrashExceptionTypeBuilder SetCode(int code)
        {
            _firebaseCrashException.code = code;
            return this;
        }

        public FirebaseCrashExceptionTypeBuilder SetName(string name)
        {
            _firebaseCrashException.name = name;
            return this;
        }

        public FirebaseCrashExceptionTypeBuilder SetMessage(string message)
        {
            _firebaseCrashException.message = message;
            return this;
        }

        public FirebaseCrashExceptionTypeBuilder SetStackTrace(string stackTrace)
        {
            _firebaseCrashException.stackTrace = stackTrace;
            return this;
        }

        public FirebaseCrashExceptionType Build()
        {
            return _firebaseCrashException;
        }
    }
}