// Code generated by go-swagger; DO NOT EDIT. package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // AdminReport AdminReport models the admin view of a report. // // swagger:model AdminReport type AdminReport struct { // Whether an action has been taken by an admin in response to this report. // Example: false ActionTaken bool `json:"action_taken,omitempty"` // If an action was taken, at what time was this done? (ISO 8601 Datetime) // Will be null if not set / no action yet taken. // Example: 2021-07-30T09:20:25+00:00 ActionTakenAt string `json:"action_taken_at,omitempty"` // If an action was taken, what comment was made by the admin on the taken action? // Will be null if not set / no action yet taken. // Example: Account was suspended. ActionTakenComment string `json:"action_taken_comment,omitempty"` // Under what category was this report created? // Example: spam Category string `json:"category,omitempty"` // Comment submitted when the report was created. // Will be empty if no comment was submitted. // Example: This person has been harassing me. Comment string `json:"comment,omitempty"` // The date when this report was created (ISO 8601 Datetime). // Example: 2021-07-30T09:20:25+00:00 CreatedAt string `json:"created_at,omitempty"` // Bool to indicate that report should be federated to remote instance. // Example: true Forwarded bool `json:"forwarded,omitempty"` // ID of the report. // Example: 01FBVD42CQ3ZEEVMW180SBX03B ID string `json:"id,omitempty"` // Array of rules that were broken according to this report. // Will be empty if no rule IDs were submitted with the report. Rules []*InstanceRule `json:"rules"` // Array of statuses that were submitted along with this report. // Will be empty if no status IDs were submitted with the report. Statuses []*Status `json:"statuses"` // Time of last action on this report (ISO 8601 Datetime). // Example: 2021-07-30T09:20:25+00:00 UpdatedAt string `json:"updated_at,omitempty"` // account Account *AdminAccountInfo `json:"account,omitempty"` // action taken by account ActionTakenByAccount *AdminAccountInfo `json:"action_taken_by_account,omitempty"` // assigned account AssignedAccount *AdminAccountInfo `json:"assigned_account,omitempty"` // target account TargetAccount *AdminAccountInfo `json:"target_account,omitempty"` } // Validate validates this admin report func (m *AdminReport) Validate(formats strfmt.Registry) error { var res []error if err := m.validateRules(formats); err != nil { res = append(res, err) } if err := m.validateStatuses(formats); err != nil { res = append(res, err) } if err := m.validateAccount(formats); err != nil { res = append(res, err) } if err := m.validateActionTakenByAccount(formats); err != nil { res = append(res, err) } if err := m.validateAssignedAccount(formats); err != nil { res = append(res, err) } if err := m.validateTargetAccount(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *AdminReport) validateRules(formats strfmt.Registry) error { if swag.IsZero(m.Rules) { // not required return nil } for i := 0; i < len(m.Rules); i++ { if swag.IsZero(m.Rules[i]) { // not required continue } if m.Rules[i] != nil { if err := m.Rules[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("rules" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("rules" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *AdminReport) validateStatuses(formats strfmt.Registry) error { if swag.IsZero(m.Statuses) { // not required return nil } for i := 0; i < len(m.Statuses); i++ { if swag.IsZero(m.Statuses[i]) { // not required continue } if m.Statuses[i] != nil { if err := m.Statuses[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *AdminReport) validateAccount(formats strfmt.Registry) error { if swag.IsZero(m.Account) { // not required return nil } if m.Account != nil { if err := m.Account.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("account") } return err } } return nil } func (m *AdminReport) validateActionTakenByAccount(formats strfmt.Registry) error { if swag.IsZero(m.ActionTakenByAccount) { // not required return nil } if m.ActionTakenByAccount != nil { if err := m.ActionTakenByAccount.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("action_taken_by_account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("action_taken_by_account") } return err } } return nil } func (m *AdminReport) validateAssignedAccount(formats strfmt.Registry) error { if swag.IsZero(m.AssignedAccount) { // not required return nil } if m.AssignedAccount != nil { if err := m.AssignedAccount.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("assigned_account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("assigned_account") } return err } } return nil } func (m *AdminReport) validateTargetAccount(formats strfmt.Registry) error { if swag.IsZero(m.TargetAccount) { // not required return nil } if m.TargetAccount != nil { if err := m.TargetAccount.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("target_account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("target_account") } return err } } return nil } // ContextValidate validate this admin report based on the context it is used func (m *AdminReport) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateRules(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateStatuses(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateAccount(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateActionTakenByAccount(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateAssignedAccount(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTargetAccount(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *AdminReport) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Rules); i++ { if m.Rules[i] != nil { if swag.IsZero(m.Rules[i]) { // not required return nil } if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("rules" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("rules" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *AdminReport) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Statuses); i++ { if m.Statuses[i] != nil { if swag.IsZero(m.Statuses[i]) { // not required return nil } if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *AdminReport) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { if m.Account != nil { if swag.IsZero(m.Account) { // not required return nil } if err := m.Account.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("account") } return err } } return nil } func (m *AdminReport) contextValidateActionTakenByAccount(ctx context.Context, formats strfmt.Registry) error { if m.ActionTakenByAccount != nil { if swag.IsZero(m.ActionTakenByAccount) { // not required return nil } if err := m.ActionTakenByAccount.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("action_taken_by_account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("action_taken_by_account") } return err } } return nil } func (m *AdminReport) contextValidateAssignedAccount(ctx context.Context, formats strfmt.Registry) error { if m.AssignedAccount != nil { if swag.IsZero(m.AssignedAccount) { // not required return nil } if err := m.AssignedAccount.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("assigned_account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("assigned_account") } return err } } return nil } func (m *AdminReport) contextValidateTargetAccount(ctx context.Context, formats strfmt.Registry) error { if m.TargetAccount != nil { if swag.IsZero(m.TargetAccount) { // not required return nil } if err := m.TargetAccount.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("target_account") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("target_account") } return err } } return nil } // MarshalBinary interface implementation func (m *AdminReport) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *AdminReport) UnmarshalBinary(b []byte) error { var res AdminReport if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }