// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IQueryLogConfig {
    anonymize_client_ip?: boolean;
    enabled?: boolean;
    interval?: number;
}

export default class QueryLogConfig {
    readonly _anonymize_client_ip: boolean | undefined;

    /** */
    get anonymizeClientIp(): boolean | undefined {
        return this._anonymize_client_ip;
    }

    readonly _enabled: boolean | undefined;

    /** */
    get enabled(): boolean | undefined {
        return this._enabled;
    }

    readonly _interval: number | undefined;

    /** */
    get interval(): number | undefined {
        return this._interval;
    }

    constructor(props: IQueryLogConfig) {
        if (typeof props.anonymize_client_ip === 'boolean') {
            this._anonymize_client_ip = props.anonymize_client_ip;
        }
        if (typeof props.enabled === 'boolean') {
            this._enabled = props.enabled;
        }
        if (typeof props.interval === 'number') {
            this._interval = props.interval;
        }
    }

    serialize(): IQueryLogConfig {
        const data: IQueryLogConfig = {
        };
        if (typeof this._anonymize_client_ip !== 'undefined') {
            data.anonymize_client_ip = this._anonymize_client_ip;
        }
        if (typeof this._enabled !== 'undefined') {
            data.enabled = this._enabled;
        }
        if (typeof this._interval !== 'undefined') {
            data.interval = this._interval;
        }
        return data;
    }

    validate(): string[] {
        const validate = {
            enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
            interval: !this._interval ? true : typeof this._interval === 'number',
            anonymize_client_ip: !this._anonymize_client_ip ? true : typeof this._anonymize_client_ip === 'boolean',
        };
        const isError: string[] = [];
        Object.keys(validate).forEach((key) => {
            if (!(validate as any)[key]) {
                isError.push(key);
            }
        });
        return isError;
    }

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