// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigResponseInfo {
    can_autofix: boolean;
    status: string;
}

export default class CheckConfigResponseInfo {
    readonly _can_autofix: boolean;

    get canAutofix(): boolean {
        return this._can_autofix;
    }

    static canAutofixValidate(canAutofix: boolean): boolean {
        return typeof canAutofix === 'boolean';
    }

    readonly _status: string;

    get status(): string {
        return this._status;
    }

    static statusValidate(status: string): boolean {
        return typeof status === 'string' && !!status.trim();
    }

    constructor(props: ICheckConfigResponseInfo) {
        this._can_autofix = props.can_autofix;
        this._status = props.status.trim();
    }

    serialize(): ICheckConfigResponseInfo {
        const data: ICheckConfigResponseInfo = {
            can_autofix: this._can_autofix,
            status: this._status,
        };
        return data;
    }

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

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