// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IError {
    message?: string;
}

export default class Error {
    readonly _message: string | undefined;

    /** */
    get message(): string | undefined {
        return this._message;
    }

    constructor(props: IError) {
        if (typeof props.message === 'string') {
            this._message = props.message.trim();
        }
    }

    serialize(): IError {
        const data: IError = {
        };
        if (typeof this._message !== 'undefined') {
            data.message = this._message;
        }
        return data;
    }

    validate(): string[] {
        const validate = {
            message: !this._message ? true : typeof this._message === 'string' && !this._message ? true : this._message,
        };
        const isError: string[] = [];
        Object.keys(validate).forEach((key) => {
            if (!(validate as any)[key]) {
                isError.push(key);
            }
        });
        return isError;
    }

    update(props: Partial<IError>): Error {
        return new Error({ ...this.serialize(), ...props });
    }
}
