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

export default class WhoisInfo {
    readonly _key: string | undefined;

    get key(): string | undefined {
        return this._key;
    }

    constructor(props: IWhoisInfo) {
        if (typeof props.key === 'string') {
            this._key = props.key.trim();
        }
    }

    serialize(): IWhoisInfo {
        const data: IWhoisInfo = {
        };
        if (typeof this._key !== 'undefined') {
            data.key = this._key;
        }
        return data;
    }

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

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